Coder Social home page Coder Social logo

asdf-python's Introduction

asdf-python

Build Status

Python plugin for asdf version manager

Install

asdf plugin-add python

Install with --patch

Enable to fix macOS 11 issues

You can use environment variable ASDF_PYTHON_PATCH_URL to install with --patch like that:

export ASDF_PYTHON_PATCH_URL="https://github.com/python/cpython/commit/8ea6353.patch?full_index=1"
asdf install python 3.6.12

or use environment variable ASDF_PYTHON_PATCHES_DIRECTORY.

Use

Check asdf readme for instructions on how to install & manage versions of Python. Please make sure you have the required system dependencies installed before trying to install Python.

Under the hood, asdf-python uses python-build to build and install Python, check its README for more information about build options and the common build problems wiki page for any issues encountered during installation of python versions.

Using multiple versions of Python

A common request for Python is being able to use the python2 and python3 commands without needing to switch version. This can be achieved by setting multiple versions of Python, for example with

asdf global python 3.6.2 2.7.13

Executables in the first version will take priority over the executables in the next one. Note that you can use an arbitrary number over versions, if needed. With the above example, python will therefore use the python executable found in version 3.6.2. However, as the python2 does not exist in Python 3.6.2, python2 will use the python2 executable found in version 2.7.13.

python -V
Python 3.6.2

python3 -V
Python 3.6.2

python2 -V
Python 2.7.13

Pip installed modules and binaries

If you use pip to install a module like ipython that has binaries. You will need to run asdf reshim python for the binary to be in your path.

Default Python packages

asdf-python can automatically install a default set of Python packages with pip right after installing a Python version. To enable this feature, provide a $HOME/.default-python-packages file that lists one package per line, for example:

ansible
pipenv

You can specify a non-default location of this file by setting a ASDF_PYTHON_DEFAULT_PACKAGES_FILE variable.

asdf-python's People

Contributors

and-semakin avatar cmckni3 avatar danhper avatar dieswaytoofast avatar djgoku avatar essh avatar fazibear avatar github-actions[bot] avatar jdx avatar jeromedoyle avatar jfly avatar joshuarosato avatar likwid avatar matan129 avatar neersighted avatar paulswartz avatar pierreneter avatar renovate[bot] avatar rlex avatar rockwood avatar smorimoto avatar zfletch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

asdf-python's Issues

Executing shims of different python versions

Hi, my problem is the following, I'm using tox with the following python versions 2.7, 3.5 and 3.6.

I have currently set python 3.5 as local in my project, when I launch the tox command it tries to create a virtualenv for each version, it successfully creates the one for 2.7 and 3.5, but when it tries to create the one for 3.6 it fails.

ERROR: py36: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError("Failed to get version_info for
python3.6: b''",)

If I try executing pyvenv-3.6 or python3.6 while my current python is 3.5 I get

No such command in 3.5.3 of python

My solution was executing tox twice, once per each python3 version, so that each execution creates the required virtualenv. This works because the virtualenvs tox creates are not modified unless you modify the tox.ini file, but It's more of a dirty fix than anything else.

Am I doing something wrong? or is this the intended behavior?

pip - ImportError: cannot import name main

I used asdf global python system; I have pip installed in ~/.local:

$ pip -V
pip 19.0.1 from /home/roger/.local/lib/python2.7/site-packages/pip (python 2.7)

But when I change to a directory which uses a local python version (2.7.15), pip no longer works:

$ cd src/foo
$ pip -V
Traceback (most recent call last):
  File "/home/roger/.asdf/installs/python/2.7.15/bin/pip", line 7, in <module>
    from pip import main
ImportError: cannot import name main

Using asdf's python with python-gst

Hi there,

I'm trying to follow the installation process for installing Mopidy from source using my python build from asdf. One key element of the process is the installation of python-gst-1.0 in ubuntu (or gst-python2 for me on Arch). How would I install this package within the context of asdf so I can run the program?

[john:~] 7s % mopidy
Traceback (most recent call last):
  File "/home/john/.asdf/installs/python/2.7.12/bin/mopidy", line 7, in <module>
    from mopidy.__main__ import main
  File "/home/john/.asdf/installs/python/2.7.12/lib/python2.7/site-packages/mopidy/__main__.py", line 8, in <module>
    from mopidy.internal.gi import Gst  # noqa: F401
  File "/home/john/.asdf/installs/python/2.7.12/lib/python2.7/site-packages/mopidy/internal/gi.py", line 9, in <module>
    gi.require_version('Gst', '1.0')
AttributeError: 'module' object has no attribute 'require_version'

can't decompress data; zlib not available make

Received the following:

ast 10 log lines:
  File "/private/var/folders/pp/8cx2m9p92hjdk1cmg6z49znw0000gn/T/python-build.20190525111851.13029/Python-3.7.2/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/pp/8cx2m9p92hjdk1cmg6z49znw0000gn/T/python-build.20190525111851.13029/Python-3.7.2/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/pp/8cx2m9p92hjdk1cmg6z49znw0000gn/T/python-build.20190525111851.13029/Python-3.7.2/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/pp/8cx2m9p92hjdk1cmg6z49znw0000gn/T/python-build.20190525111851.13029/Python-3.7.2/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
 !  ~ 

I do have zlib installed via MacPorts. A bit rusty on how to make this visible. Also, can it be detected automatically?

--enable-shared and --enable-framework

similar to this: pyenv/pyenv#99

there are moments when we need to tell python to install with these options

for example, I'm trying to distribute a tool I wrote with PyInstaller, but when running the command, using Python 3.6.1 installed with asdf and within a venv, it complains that it can't find libpython3.6.dylib

Installing binaries using the bundled pip

I am trying to install flask. It itself installs fine when running pip install flask, but I cannot figure out how to run the binary that it is supposed to install as well (The FLASK_APP=hello.py flask run command does not work, because the flask binary cannot be found).

Where does asdf-python install the binaries to? Do I need to add some directory to my PATH?

Use the default version of python

How can I use the default version of python? I set only a local version but when I'm out of that folder I can't use the system version of python.

Is there any way to use pip with an asdf python version?

I'm left in the dark, I need to run pip with asdf because the discord.py rewrite requires python >=3.5.3 and ubuntu's version is literally 3.5.2. i've run asdf install python 3.6.8 and asdf local python 3.6.8 and even asdf global python 3.6.8 and I don't know what to do.

It doesn't work on Mac

I am using Mac High Sierra and I couldn't use asdf for python at all. Below is the versions of python I have installed:

$ asdf list python
2.7
3.5
3.6.3
3.6

when I change to 3.6 as blow I couldn't run python command:

$ asdf global python 3.6
$ which python
/Users/joey/.asdf/shims/python
$ python --version
No such command in 3.6 of python

I always get No such command xx of python for every version of python. Is there any other configuration I need to make?

ModuleNotFound DistUtilsExtra

I'm running Arch, and after installing asdf-python some packages that requires python-distutils-extra are throwing an error during install.

This is the error:

Traceback (most recent call last):
  File "setup.py", line 8, in <module>
    from DistUtilsExtra.command import *
ModuleNotFoundError: No module named 'DistUtilsExtra'

This won't happen if I remove asdf-python

Can anyone help me please?

Python2.7 install fails on Antergos(Arch Linux)

Because of problems below, build fall into error.

Maybe this is difficult to solve now so, I write a current solution.
I hope this post will help you faced similar problems.

sudo pacman -S gcc7
export CC=/usr/bin/gcc-7          
export CXX=/usr/bin/g++-7         
export CFLAGS=-I/usr/include/tirpc
asdf install python 2.7.13

Automatically run reshim?

Hey guys,

I use ASDF for a lot of different langs, but in python anytime I install a new package via pip or pip3 I need to run asdf reshim python to get it to load correctly.

Is this intended behaviour? In other langs, e.g., JS, Elixir, Ruby, you don't need to do this.

Thanks!

Using asdf python with virtual env

There gotta to be something pretty basic I am missing.

I have multiple virtual environments for multiple projects, I use this to isolate dependencies between the various projects.

Here I have a ".tools-version" that is different from the "global" python version:

HSCode/  › python --version
Python 3.7.2
HSCode/  › cd test
test/  › python --version
Python 2.7.14

Based on that I want to create a new virtualenev that will work with the local python version, however:

test/  › mkvirtualenv -p $(which python) test_venv
Running virtualenv with interpreter /Users/$$$/.asdf/shims/python
Using base prefix '/Users/$$$/.asdf/installs/python/3.7.2'
New python executable in /Users/$$$/.virtualenvs/test_venv/bin/python
Installing setuptools, pip, wheel...done.

(test_venv) test/  › python --version
Python 3.7.2

Any ideas or pointers regarding the workflow for virtual environments + asdf-python ?

error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file

Hi there!

asdf plugin-add python https://github.com/tuvistavie/asdf-python.git
asdf install python 2.7.9
asdf local python 2.7.9
asdf reshim python 2.7.9
python -v

Produces:

/home/john/.asdf/installs/python/2.7.9/bin/python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

I'm sticking to using Arch's python, python-pip, python2, and python2-pip packages for now but I'd like to use asdf instead.

I'm not sure what other info you might need so let me know!

Can't get running asdf-python with tkinter

I am using asdf on an Ubuntu 18 desktop.
Python 3.7.2 is set up, and I am trying to get appJar running. It asks for tkinter-lib but I have no clue, how to put both ends together.

hardcoded path to asdf home dir

this plugin expects asdf home to be ~/.asdf, but that might not be the case
if asdf is in a different folder, it does not work

installed pip, for example hg, not found

using this asdf pluging , run
pip install mercurial
hg is installed, but can not be executed since it is not in PATH
bit it is in ~/.asdf/installs/python/2.7.13/bin

Python ssl extension isn't compiled on macOS 10.13 High Sierra

I currently have pyenv (1.1.5) and openssl (2.2.7) installed via homebrew. Installing 3.6.3 fails because the ssl extension wasn't compiled. The terminal output is:

asdf install python 3.6.3
python-build 3.6.3 /Users/jerome.doyle/.asdf/installs/python/3.6.3
Downloading Python-3.6.3.tar.xz...
-> https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
Installing Python-3.6.3...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.13 using python-build 1.1.5-8-g7b9d1a4)

Inspect or clean up the working tree at /var/folders/p6/k0c_hqr95_14y4z52gcq_zwm0000gn/T/python-build.20171018124832.29730
Results logged to /var/folders/p6/k0c_hqr95_14y4z52gcq_zwm0000gn/T/python-build.20171018124832.29730.log

Last 10 log lines:
			upgrade) ensurepip="--upgrade" ;; \
			install|*) ensurepip="" ;; \
		esac; \
		 ./python.exe -E -m ensurepip \
			$ensurepip --root=/ ; \
	fi
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0
Cleaning up

Pip install fails on macOS

When I attempt to install any python version with this plugin, I get the following error trying to install pip:

BUILD FAILED (OS X 10.13.2 using python-build 1.1.4-4-g433e2d1)

Inspect or clean up the working tree at /var/folders/y2/6bz4kq_s029_syhvswcw7w6w0000gn/T/python-build.20171215212552.54169
Results logged to /var/folders/y2/6bz4kq_s029_syhvswcw7w6w0000gn/T/python-build.20171215212552.54169.log

Last 10 log lines:
rm -f /Users/nate/.asdf/installs/python/2.7.14/share/man/man1/python.1
(cd /Users/nate/.asdf/installs/python/2.7.14/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno"  ; then \
		case no in \
			upgrade) ensurepip="--upgrade" ;; \
			install|*) ensurepip="" ;; \
		esac; \
		 ./python.exe -E -m ensurepip \
			$ensurepip --root=/ ; \
	fi
Cleaning up

This was a known issue with pyenv as well, however it has been resolved with the latest deployment on homebrew, which patches python-build to reference the correct libraries.

Is it possible to follow suit and patch asdf as well? I'm not currently able to use asdf for python and have reverted back to pyenv until a resolution can be found.

Error installing Python on OS X Mojave

I tried installing both 3.7.1 and 3.6.7 with the same result shown below. It seems Mojave may have removed zlib: https://stackoverflow.com/questions/48288658/zipimport-zipimporterror-cant-decompress-data-zlib-not-available#comment92859734_50370494.

asdf install python 3.6.7
python-build 3.6.7 /Users/geowa4/.asdf/installs/python/3.6.7
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.7.tar.xz...
-> https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
Installing Python-3.6.7...
python-build: use readline from homebrew

BUILD FAILED (OS X 10.14 using python-build 1.2.7-11-g835707da)

Inspect or clean up the working tree at /var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974
Results logged to /var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974.log

Last 10 log lines:
  File "/private/var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974/Python-3.6.7/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974/Python-3.6.7/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974/Python-3.6.7/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/p6/2v_qbpvs41dd7yq9c3g2cqvh0000gn/T/python-build.20181026220617.38974/Python-3.6.7/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

asdf-python and pacman

Hey there,

I've been using this plugin since 2016 (!) and asdf is still by far my favourite version manager.

Since the start, I've had issues with asdf's python confusing applications which rely on the system python.

In my ~/.tool-versions, I have my python setup like so:

python system 3.8.2 2.7.17

I understand that this line will try the system python first, then try 3.8.2, then 2.7.17.

When I reshim python, then trigger my AUR package updates, I get the following error:

asdf reshim python && yay -Syu
< SNIP >
copying aigpy/__main__.py -> build/lib/aigpy
running egg_info
writing requirements to aigpy.egg-info/requires.txt
writing aigpy.egg-info/PKG-INFO
writing top-level names to aigpy.egg-info/top_level.txt
writing dependency_links to aigpy.egg-info/dependency_links.txt
reading manifest file 'aigpy.egg-info/SOURCES.txt'
writing manifest file 'aigpy.egg-info/SOURCES.txt'
==> Entering fakeroot environment...
==> Starting package_python-aigpy()...
unknown command: python. Perhaps you have to reshim?
==> ERROR: A failure occurred in package_python-aigpy().
    Aborting...
Error making: python-aigpy

Looking at the python-aigpy package, python is being called like so:

  depends=(
    'python2'
    'python2-requests'
    'python2-libconfigparser'
    'python2-colorama'
    'python2-mutagen'
    'python2-futures'
  )
  cd "${srcdir}/${_pkgname}-${pkgver}-2"
  python2 setup.py install --root="${pkgdir}/" --optimize=1 --skip-build
  install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

which python2 points to /home/john/.asdf/shims/python2.

I'm not entirely sure where to go from here - how can I ensure that pacman installs packages with the system pythons?

Python2/Python3 side-by-side problems

Currently, when using asdf-python, if you have configured the version of Python to be 3.x.x in some directory, the command python2 will return:

No such command in 3.x.x of python

Whereas when you configure it to use python 2.x.x, it will return, when calling python3:

No such command in 2.x.x of python

I have come across problems were a build script attempted to find out if python 2 or python 3 was installed. (they use which python2 to see if we use Python 2, which succeeds as this returns /home/yourusername/.asdf/shims/python2. But then actually calling this binary will fail with above error.)

I think it would be better behaviour if the ASDF wrapper for these binaries would:

  1. Check if the current folder's version of Python has the same major version as the wrapper.
  2. If not, print a warning to alert the user what is going on, and pass on through to the system-configured (outside of ASDF)'s python2 resp. python3.

The python version's bin directory is set in path

Using asdf python plugin's pip i try to install awscli, which gets installed properly at ~/.asdf/installs/python/3.7.0/bin. But that location is not set on the env, so rendering awscli unusable.

Python anaconda install conflicting with git/gettext

Hey guys, installed Anaconda3 v5.3.0 like so

$ asdf install python anaconda3-5.3.0

and it seems that something is in conflict with gettext/git now.

What is the experienced (undesired) behaviour?

$ git pull
GNU gettext shell script function library version 0.19.8.1
Usage: . gettext.sh

What points me this way?

With python anaconda3-5.3.0

$ which gettext
~/.asdf/shims/gettext

where

$ cat ~/.asdf/shims/gettext
#!/usr/bin/env bash
# asdf-plugin: python
# asdf-plugin-version: anaconda3-5.3.0
exec /usr/local/opt/asdf/libexec/private/asdf-exec python bin/gettext "$@"

and

$ ls -al ~/.asdf/shims | wc -l
     415

Without it

After uninstalling it

$ asdf uninstall python anaconda3-5.3.0
$ git pull
Current branch master is up to date.

🎉, and FWIW, there are far fewer shims now.

$ ls -al ~/.asdf/shims | wc -l
      31

Honestly, I don't even know if this is the right place to ask this question versus this being an asdf issue, or python, or anaconda, or something completely different?

I'm open to getting help on debugging this further, or being guided to a better place to ask this, or anything else. Thanks in advance! ✌️


PS: Context folded below I'm running macOS with git 2.19.1
$ sw_vers -productVersion
10.13.6

$ git --version
git version 2.19.1

shim doesn't work when asdf installed with Homebrew

Homebrew has a policy that only executables may be installed in bin/ (I asked and they won't make an exception for asdf). Therefore they install asdf-exec to libexec/private and thus the asdf-python shim fails.

exec $(asdf_dir)/bin/private/asdf-exec python bin/python${short_python_version} "$@"

I'm not really sure how this should be fixed, but FYI.

Unable to install Python 3.8.0 on MacOs Catalina

asdf install python 3.8.0

Results in:

python-build 3.8.0 /Users/maxim.danilov/.asdf/installs/python/3.8.0
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 10.15.1 using python-build 1.2.15-4-g089b828b)

Inspect or clean up the working tree at /var/folders/p5/msx_fqfd65545mstbnd7md380000gn/T/python-build.20191210165950.63262
Results logged to /var/folders/p5/msx_fqfd65545mstbnd7md380000gn/T/python-build.20191210165950.63262.log

Last 10 log lines:
	if test $? -ne 0 ; then \
		echo "generate-posix-vars failed" ; \
		rm -f ./pybuilddir.txt ; \
		exit 1 ; \
	fi
Fatal Python error: config_get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed
Python runtime state: preinitialized

generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1

Seems like this has to do something with locales.
I'm using zsh and have the following vars for locale related stuff:

export LC_ALL="en_US"
export LC_CTYPE="en_US"
export LANG="en_US"

Support re-install\auto-install of default pip global packages

It would be a great feature if when a new Python is installed (or the existing one is being upgraded) that a list of default "global" packages could be installed. Perhaps use a config file like $HOME/.default-pip-packages or something to that effect. The Node asdf plugin supports this and it is really convenient for command-line tools you always want installed from PIP (like youtube-dl for instance).

SyntaxError when executing `python -c`

Hello!

I have a weird problem here (not sure it's asdf-python issue though):

$ /usr/bin/python --version
$ ~/.asdf/shims/python --version

$ /usr/bin/python -c 'import sys; print("python")'
python

$ ~/.asdf/shims/python -c 'import sys; print("python")'
  File "<string>", line 1
    import
         ^
SyntaxError: invalid syntax

I would simply ignore this, but anaconda-mode in spacemacs is using -c to evaluate code, and throws an error every time I type something in a python file in spacemacs.

how to use with sudo?

$ pip -V
pip 18.1 from /home/user/.asdf/installs/python/3.6.10/lib/python3.6/site-packages/pip (python 3.6)

$ pip install ps_mem
Collecting ps_mem
  Downloading https://files.pythonhosted.org/packages/46/81/ff8429735e2eb13be225dcfabef16d90bfa96b559e3f2643935d33b67697/ps_mem-3.12.tar.gz
Installing collected packages: ps-mem
  Running setup.py install for ps-mem ... done
Successfully installed ps-mem-3.12
You are using pip version 18.1, however version 20.2b1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

$ ps_mem
-bash: ps_mem: command not found
$ asdf reshim

$ ps_mem
Sorry, root permission required, or specify pids with -p
$ sudo ps_mem
unknown command: ps_mem. Perhaps you have to reshim?
$ asdf exec ps_mem
Sorry, root permission required, or specify pids with -p
$ sudo asdf exec ps_mem
unknown command: ps_mem. Perhaps you have to reshim?

Anaconda Install error

installing anaconda raises this error

Last 10 log lines: /var/folders/60/24fdw4jx7vl02x0rw7f0m3lm0000gn/T/python-build.20170122172041.45403 ~/.asdf/plugins /var/folders/60/24fdw4jx7vl02x0rw7f0m3lm0000gn/T/python-build.20170122172041.45403/Anaconda2-4.2.1-MacOSX-x86_64 /var/folders/60/24fdw4jx7vl02x0rw7f0m3lm0000gn/T/python-build.20170122172041.45403 ~/.asdf/plugins ERROR: File or directory already exists: /Users/jinx/.asdf/installs/python/anaconda2-4.2.0 Cleaning up

Can be fixed by deleting the install path prior to installing python.

rm -rf "$install_path" && MAKE_OPTS="$MAKE_OPTS -j$ASDF_CONCURRENCY" TMP_DIR="$tmp_dir" $(python_build_path) $version $install_path

Link to system dependencies in README

If you install python without all required system dependencies the install will either fail or (imho even worse) it will run through but will sometimes fail at runtime because of missing modules.
A link in the README would help.

Python builds without readline or openssl support

Problem

When installing python 2.7.9, readline and openssl modules are not built and installed.

Steps to reproduce

  1. Install python:
asdf install 2.7.9`
  1. Use python:
asdf local python 2.7.9
  1. Launch interactive python and attempt to import the modules:
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named readline

>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Chris/.asdf/installs/python/2.7.9/lib/python2.7/ssl.py", line 97, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl

You can also use the arrow keys and typical ctrl-* navigation commands and see the escape sequences being output.

Possible solution

Reviewing the build output, it looks the install script is setting openssl and readline options that aren't valid for python:

configure: WARNING: unrecognized options: --with-openssl-dir, --with-readline-dir, --disable-install-doc

I checked homebrew's python formula, and they are patching setup.py's readline and openssl configurations with paths to homebrew's versions.

It seems like this is the strategy required to fix this problem. Unfortunately, my bash skills aren't sharp enough to make the change myself and PR.

Python 3.4.7 not available

Hey, I know this is kind of a small thing, but I need 3.4.7 specifically. I've loved using asdf for python and I'd like to keep using it. It looks like 3.4.7 is available in pyenv: https://github.com/pyenv/pyenv/releases/tag/v1.1.4 I've tried running asdf plugin-update --all but that didn't help. Is there something else I should do to get new Python versions?

And is there some way to automatically get new versions as they become available?

Eric

Multiple versions of python fail to install with `asdf install`

Steps to reproduce

On a brand new install of asdf, I tried to execute cd ~ && asdf install with this ~/.tool-versions file:

python 3.7.3 2.7.16

Expected behavior

python-build 3.7.3 /home/kevin/.asdf/installs/python/3.7.3
Downloading Python-3.7.3.tar.xz...
-> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
Installing Python-3.7.3...
Installed Python-3.7.3 to /home/kevin/.asdf/installs/python/3.7.3
python-build 2.7.16 /home/kevin/.asdf/installs/python/2.7.16
Downloading Python-2.7.16.tar.xz...
-> https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz
Installing Python-2.7.16...
Installed Python-2.7.16 to /home/kevin/.asdf/installs/python/2.7.16

Actual behavior

python-build 3.7.3 2.7.16 /home/kevin/.asdf/installs/python/3.7.3 2.7.16
python-build: definition not found: 3.7.3 2.7.16

Environment

OS: Arch Linux

asdf version: 0.7.2

module issue

For some reason, even after a module is installed (pygresql) via pip, its failing to load:

import csv
import pygresql

% python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    import pygresql
% which python
/Users/xxx/.asdf/shims/python
% pip install pygresql
Requirement already satisfied: pygresql in /Users/xx/.asdf/installs/python/3.7.3/lib/python3.7/site-packages (5.1)

When removing Python plugin shims are not destroyed

This causes shims that would otherwise not exist to block the path to installations of python in later directories. Expected behavior would be for plugin-removal to delete these 'null-ptr' executables, allowing installations outside of asdf to execute. Instead the user will execute the invalid shims, receiving an error message 'No such plugin'.

Error: Cannot install any version

Hi,
So I upgraded my mac to Sierra 10.12.2 and cannot install any version of python. It throws this error and stops abruptly.

Downloading python-build...
python-build 3.4.5 /Users/raven/.asdf/installs/python/3.4.5
Downloading Python-3.4.5.tar.xz...
-> https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tar.xz
error: failed to download Python-3.4.5.tar.xz

BUILD FAILED (OS X 10.12.2 using python-build 1.0.4-11-ga73d90b)

Cleaning up

No such command in 3.6.4 of python on "clear" command.

After installing and doing "asdf global or local python 3.6.4" then if i do "clear" command i get
No such command in 3.6.4 of python
How to fix?

Edit: why do i have clear on shims?

$ which clear
/home/qwexvf/.asdf/shims/clear

Thanks.

Python 1.8 not available

➜  folder git:(development) ✗ asdf list-all ruby | grep 1.8
jruby-9.1.8.0
1.8.5-p115
1.8.6-p114
1.8.6-p383
1.8.6-p388
1.8.6-p398
1.8.6-p399
1.8.6-p420
1.8.7-p174
1.8.7-p248
1.8.7-p249
1.8.7-p299
1.8.7-p302
1.8.7-p330
1.8.7-p334
1.8.7-p352
1.8.7-p357
1.8.7-p358
1.8.7-p370
1.8.7-p371
1.8.7-p374
2.1.8
➜  folder git:(development) ✗ asdf install ruby 1.8.7-p374
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168  100   168    0     0    238      0 --:--:-- --:--:-- --:--:--   238

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Can't install packages on Ubuntu

Looks like pip tries to install to the system python package directory instead of the asdf directory. Kind of defeats the purpose.

How to use pyenv virtualenv?

Is there a way to use pyenv virtualenv with asdf-python?

I don't pollute the global Python environment with my packages. So, I create a virtualenv using pyenv virtualenv:

$ pyenv virtualenv 3.7.6 jupyter
$ pyenv activate jupyter
(jupyter) $ pip install jupyter matplotlib pandas scipy
(jupyter) $ pyenv deactivate
$ pyenv global 3.7.6 jupyter

Is there a way to achieve that with asdf-python?

Thanks in advance.

After installing Python with asdf I have a diferent version of cURL installed and running

I am not sure if this is Python, asdf or Emacs related but I have to start somewhere.

whereis curl
curl: /usr/bin/curl /home/cobi/.asdf/shims/curl /home/linuxbrew/.linuxbrew/bin/curl /usr/share/man/man1/curl.1.gz

Running Ubuntu 18.04.02 64 bits I had a version of cURL installed:

/usr/bin/curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

This particular version did not work well with Emacs and there was some issues about certificates, so I installed with HOMEBREW a different version:

/home/linuxbrew/.linuxbrew/bin/curl --version
curl 7.63.0 (x86_64-pc-linux-gnu) libcurl/7.63.0 OpenSSL/1.0.2q
Release-Date: 2018-12-12
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP UnixSockets HTTPS-proxy 

After installing Python with asdf, I got this version working:

asdf list
python
  3.7.0
  anaconda3-5.3.1
/home/cobi/.asdf/shims/curl --version
curl 7.61.0 (x86_64-conda_cos6-linux-gnu) libcurl/7.61.0 OpenSSL/1.0.2p zlib/1.2.11
Release-Date: 2018-07-11
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy 

Emacs uses cURL for several tasks inside some packages installed, like twittering-mode, to twit inside Emacs.
I do not know why Python 3.7.0 takes over the system installed cURL.
So far this particular version works ok in BASH CLI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.