asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
656 stars 56 forks source link

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

Closed typecasto closed 5 years ago

typecasto commented 5 years ago

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.

eknowlton commented 5 years ago

pip should be included with the installation.

danhper commented 5 years ago

Indeed, pip should be there. Maybe try asdf reshim after you install Python. Please comment if this does not resolve the issue.

NewAlexandria commented 4 years ago

It did not solve the issue for me @danhper - still exploring how pip is wired to python. my pip and pip3 all reference the OS-native version (OSX 10.14)

danhper commented 4 years ago

What version of python did you install?

NewAlexandria commented 4 years ago

3.8.0

danhper commented 4 years ago

Could you check the result of the following commands please?

echo $PATH
which python
asdf current
asdf which pip
typecasto commented 4 years ago

I just went with pipenv instead, as it suits my needs better.

NewAlexandria commented 4 years ago

@danhper I don't know what it was now, sorry. I had fished around with my /usr/local links, I think. Pardon that I forget what I did, but I no longer have any issue installing any binary.

👍 asdf is bueno.

danhper commented 4 years ago

Ok, if it seems to be working for everyone I'll leave this issue closed. Please open a new issue if needed.

NewAlexandria commented 4 years ago

Going to ping here and maybe re-open the matter. I've setup another laptop recently, and am having the same issue.

 which python
/Users/newalexandria/.asdf/shims/python
asdf which pip
/Users/newalexandria/.asdf/installs/python/3.8.0/bin/pip
which pip
/usr/local/bin/pip

Did I miss a configuration step?

NewAlexandria commented 4 years ago

Closing again :( My path was borked. Good note for others, though.

viniciusban commented 4 years ago

Did I miss a configuration step?

If you did set the asdf current python version, you should be able to:

$ python -m pip install you_package
NewAlexandria commented 4 years ago

My path had lots of other things prepended to it, via twisty tunnel of shell configs

dialex commented 3 years ago

Well I'm getting the same issue. I installed asdf with brew and had to use this fix.

echo $PATH
/usr/local/opt/asdf/shims:/usr/local/opt/asdf/bin:/usr/local/opt/asdf//shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

which python
/usr/bin/python

asdf current
Oohes nooes ~! No plugins installed

asdf which pip
unknown command: pip. Perhaps you have to reshim?

reshim didn't fix the issue. What am I missing?


Update: 🤔 hmmm apparently after I applied the brew fix it no longer detects the python asdf plugin. I installed it again. Ok now it works. ✅

❯ asdf current                                                 2m 26s
python          3.9.0           /Users/dnr8329/.tool-versions
❯ pip -V
pip 20.2.3 from /usr/local/opt/asdf/installs/python/3.9.0/lib/python3.9/site-packages/pip (python 3.9)

So brew users must be aware of that fix, otherwise it will mess up the installation.

jkpr commented 3 years ago

If you have the right python, then you can always use python -m pip COMMAND to make sure you are using pip for that python.

cddr commented 3 years ago

Hi,

I'm on linux and face this problem. I'm new to asdf and had probably previously borked my python installation by upgrading the distribution from whatever the previous version of ubuntu was to focal. Here are the diagnostics...

which python
/home/andy/.asdf/shims/python

asdf current
clojure         ______          No version set. Run "asdf <global|shell|local> clojure <version>"
python          3.8.8           /home/andy/.tool-versions

asdf which pip
unknown command: pip. Perhaps you have to reshim

When I try to reshim, after entering the command, a new prompt is displayed but nothing else seems to happen. I can confirm (for anyone else stumbling across this thread) the suggested workaround of using python -m pip COMMAND does work

aronreisx commented 2 years ago

python -m pip <command-name> seems fine, although I am very use to the old approach that you could just type pip <command-name> On the Linux, using Zsh, I did just add an alias to my .zshrc file: alias pip="python -m pip"

Suits just fine.

gitaarik commented 1 year ago

I also have this problem on Arch 5.15.63-1-lts. With python -m pip it indeed works, and then install Pipenv with python -m pip install pipenv and then use Pipenv with python -m pipenv install <package>.

Why aren't the asdf shims working? It does seem to work for newer versions of python installed through asdf.

Burtannia commented 1 year ago

I am also having this issue. Using pip references the system level install of Python rather than the asdf version. Using python -m pip is a sufficient work around for now but it would be nice to just use pip.

echo $PATH
/Users/jburton/.docker/bin:/Users/jburton/google-cloud-sdk/bin:/usr/local/Cellar/rabbitmq/3.8.16/sbin:/Users/jburton/.local/bin:~/.mix/escripts:/Users/jburton/bin:/usr/local/bin:/Users/jburton/.asdf/shims:/Users/jburton/.asdf/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/jburton/.docker/bin:/Users/jburton/.cabal/bin:/Users/jburton/.ghcup/bin:/Users/jburton/google-cloud-sdk/bin:/usr/local/Cellar/rabbitmq/3.8.16/sbin:/Users/jburton/.local/bin:~/.mix/escripts:/Users/jburton/bin:/Users/jburton/.cargo/bin:

which python
/Users/jburton/.asdf/shims/python

asdf current
python          3.11.1          /Users/jburton/Projects/gcf-101/.tool-versions

asdf which pip
/Users/jburton/.asdf/plugins/python/shims/pip
tbrechner commented 1 year ago

Edit: Nevermind, VSCode was using the Python interpreter of my system at /usr/bin/python3 instead of the asdf version. I have fixed it by switching the Python interpreter.

I am also having this issue. VSCode is stating ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2. However, when I attempt to install it using pip install jinja2 or python -m pip install jinja2, it seems successful:

Collecting jinja2
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Requirement already satisfied: MarkupSafe>=2.0 in ./.asdf/installs/python/3.11.4/lib/python3.11/site-packages (from jinja2) (2.1.3)
Installing collected packages: jinja2
Successfully installed jinja2-3.1.2

However, I still get that same error in VSCode that I am missing the dependency. I have attempted using `asdf reshim` too.
echo $PATH
/Users/myusername/.asdf/shims:/Users/myusername/.asdf/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin  

which python
/Users/myusername/.asdf/shims/python

asdf current
python          3.11.4          /Users/myusername/.tool-versions

asdf which pip
/Users/myusername/.asdf/plugins/python/shims/pip
Marca01 commented 1 year ago

Edit: Nevermind, VSCode was using the Python interpreter of my system at /usr/bin/python3 instead of the asdf version. I have fixed it by switching the Python interpreter.

I am also having this issue. VSCode is stating ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2. However, when I attempt to install it using pip install jinja2 or python -m pip install jinja2, it seems successful:

Collecting jinja2
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Requirement already satisfied: MarkupSafe>=2.0 in ./.asdf/installs/python/3.11.4/lib/python3.11/site-packages (from jinja2) (2.1.3)
Installing collected packages: jinja2
Successfully installed jinja2-3.1.2

However, I still get that same error in VSCode that I am missing the dependency. I have attempted using `asdf reshim` too.
echo $PATH
/Users/myusername/.asdf/shims:/Users/myusername/.asdf/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin  

which python
/Users/myusername/.asdf/shims/python

asdf current
python          3.11.4          /Users/myusername/.tool-versions

asdf which pip
/Users/myusername/.asdf/plugins/python/shims/pip

I have the same issue. The package was installed in .local not .asdf