Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install from pypi is broken for venvs #16

Closed
ttylec opened this issue Aug 27, 2019 · 4 comments
Closed

pip install from pypi is broken for venvs #16

ttylec opened this issue Aug 27, 2019 · 4 comments
Labels

Comments

@ttylec
Copy link

ttylec commented Aug 27, 2019

Here is what I got when installed in fresh temporary python venv:

➜  ~ mktmpenv --python=/usr/bin/python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/ttylec/.virtualenvs/tmp-195183325368ab1e/bin/python3
Also creating executable in /home/ttylec/.virtualenvs/tmp-195183325368ab1e/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
This is a temporary environment. It will be deleted when you run 'deactivate'.
(tmp-195183325368ab1e) ➜  tmp-195183325368ab1e python --version
Python 3.6.8
(tmp-195183325368ab1e) ➜  tmp-195183325368ab1e pip install pyan3
Collecting pyan3
  Using cached https://files.pythonhosted.org/packages/1a/82/d1b47fbcde2472d5954b4ed70cc3acf67d27bb0e83cf9b5cd5785684c629/pyan3-1.0.4-py3-none-any.whl
Installing collected packages: pyan3
Successfully installed pyan3-1.0.4
(tmp-195183325368ab1e) ➜  tmp-195183325368ab1e pyan3
Traceback (most recent call last):
  File "/home/ttylec/.virtualenvs/tmp-195183325368ab1e/bin/pyan3", line 7, in <module>
    from pyan import main
ModuleNotFoundError: No module named 'pyan'

Installing from within cloned repo works.

@Technologicat
Copy link
Owner

I have to admit that, although it's not recommended, I usually use the system Python (with pip install --user for packages), so I hadn't noticed this. Thanks for letting me know!

Judging by the error message, it seems the pyan module is not getting installed to site-packages of the temporary venv for some reason. I take it installing other packages in a temporary venv works?

@ttylec
Copy link
Author

ttylec commented Aug 27, 2019

Yes, it works. Just a bit more details:

when pip installed from git repo within temporary virtualenv

(tmp-1aed8d19cf30cb7d) ➜  pyan git:(master) ✗ head $(which pyan3)
#!/home/ttylec/.virtualenvs/tmp-1aed8d19cf30cb7d/bin/python3
# -*- coding: utf-8 -*-

import re
import sys

and when pip installed from pypi:

(tmp-5cd86f124b295af1) ➜  tmp-5cd86f124b295af1 head $(which pyan3)
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import re
import sys

In the latter case, the python interpreter path if not set properly (it points to system interpreter, not one within venv).

@Technologicat
Copy link
Owner

Thanks the analysis! The script using the wrong interpreter explains why it's not finding the module. Wait, I thought I already fix... aaaah, no, I didn't! See #11.

The hardcoded hashbang is at least part of it - there may also be something else. I suppose I'll first fix #11, and then set up a venv and have a look myself. :)

@Technologicat Technologicat changed the title pip install from pypi is broken (?) pip install from pypi is broken for venvs Aug 30, 2019
@Technologicat
Copy link
Owner

PyPI package pyan3 updated. Please try again with the latest version, and reopen this issue if necessary.

(This should work in the new 1.1.1.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants