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

Cannot run anything installed by pipsi (module not found) #144

Open
1oglop1 opened this issue May 11, 2018 · 5 comments
Open

Cannot run anything installed by pipsi (module not found) #144

1oglop1 opened this issue May 11, 2018 · 5 comments

Comments

@1oglop1
Copy link

1oglop1 commented May 11, 2018

I installed pipsi on my macbook and found out two problems, which should be probably split into two issues, one is that I cannot upgrade pipsi

user@MacBook-Pro:~/Downloads$ pipsi install pew
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/user/.local/venvs/pew/bin/python3
Also creating executable in /Users/user/.local/venvs/pew/bin/python
Installing setuptools, pip, wheel...done.
Collecting pew
  Using cached https://files.pythonhosted.org/packages/53/77/9ca8e2b4eb0c5d0de534f8de64a5e6dbe8375e7134aa9797e8f9ce7d6f53/pew-1.1.5-py2.py3-none-any.whl
Collecting virtualenv-clone>=0.2.5 (from pew)
  Using cached https://files.pythonhosted.org/packages/6d/c2/dccb5ccf599e0c5d1eea6acbd058af7a71384f9740179db67a9182a24798/virtualenv_clone-0.3.0-py2.py3-none-any.whl
Collecting virtualenv>=1.11 (from pew)
  Using cached https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=17.1 in /Users/user/.local/venvs/pew/lib/python3.6/site-packages (from pew) (39.1.0)
Installing collected packages: virtualenv-clone, virtualenv, pew
  The script virtualenv-clone is installed in '/Users/user/.local/venvs/pew/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script virtualenv is installed in '/Users/user/.local/venvs/pew/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script pew is installed in '/Users/user/.local/venvs/pew/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pew-1.1.5 virtualenv-15.2.0 virtualenv-clone-0.3.0
  Linked script /Users/user/.local/bin/pew
Done.

After installation

user@MacBook-Pro:~/Downloads$ pew
Traceback (most recent call last):
  File "/Users/user/.local/bin/pew", line 7, in <module>
    from pew.pew import pew
ModuleNotFoundError: No module named 'pew'

PATH

user@MacBook-Pro:~/Downloads$ echo $PATH
/Users/user/.local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
@1oglop1 1oglop1 changed the title cannot upgrade Cannot run anything installed by pipsi (module not found) May 11, 2018
@zymergen-luke
Copy link

I'm running into the same problem. The hashbang inserted into the bin script is pointing to the system python binary rather than the binary in the associated virtualenv. I can manually change the hashbangs in the bin directory to make it execute on the correct python, but other functions like pipsi list fail (looking for package_info.json files in the root of the venv that don't exist).

@zymergen-luke
Copy link

I also noticed that it's falsely warning that ~/.local/bin is not on my path. It looks like the command_exists function is improperly using subprocess.call and passing the cmd name without a full path. All other calls to subprocess.call are properly passing full paths. In order to not pass a full path you'll want to pass it as a string with shell=True.

Alternatively, I think it would be more direct to use find_executable:

from distutils.spawn import find_executable

def command_exists(cmd):
    return bool(find_executable(cmd))

Changing command_exists removed the incorrect warning, but did not fix the problems listed in this issue

@bjoernpollex-sc
Copy link

This seems to be the same issue as #118. I've tried a fix previously, but it wasn't that straightforward. I have some time now, so I'll look into it again.

@RonnyPfannschmidt
Copy link
Contributor

this seems to be an issue with using venv, as it needs a different logic to find the real python for fixing scripts - im not sure if/when i find time to look at it

@bjoernpollex
Copy link

This has been fixed for me in #142, maybe you can check if it works with current master, and close if it does?

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

No branches or pull requests

5 participants