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

get-pipsi custom Python broken #100

Open
pikeas opened this issue Jul 5, 2017 · 10 comments
Open

get-pipsi custom Python broken #100

pikeas opened this issue Jul 5, 2017 · 10 comments

Comments

@pikeas
Copy link

pikeas commented Jul 5, 2017

Followup to #88.

$ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3
...
Installed pipsi binary in /Users/apikeas/.local/bin
pipsi is now installed.
$ pipsi install saws
Running virtualenv with interpreter /Users/apikeas/.local/venvs/pipsi/bin/python3.6
Using base prefix '/usr/local/Cellar/python3/3.6.1/bin/../Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/apikeas/.local/venvs/saws/bin/python3.6
Also creating executable in /Users/apikeas/.local/venvs/saws/bin/python
ERROR: The executable /Users/apikeas/.local/venvs/saws/bin/python3.6 is not functioning
ERROR: It thinks sys.prefix is '/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6' (should be '/Users/apikeas/.local/venvs/saws')
ERROR: virtualenv is not compatible with this system or executable
Failed to create virtualenv.  Aborting.

If I remove pipsi and retry with python instead of python3, everything works. Both Pythons were installed by Homebrew into /usr/local/bin.

@pikeas
Copy link
Author

pikeas commented Jul 14, 2017

I have a little bit of additional color on this.

There is one happy path:

pip3 install virtualenv
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3
# Change ~/.local/bin/pipsi shebang line to use .local/venvs/pipsi/bin

If these three conditions are met, in this order, everything seems to work fine. If virtualenv is installed after the fact or the shebang line isn't changed, pipsi and/or the packages installed by it fail in various weird ways.

@jedie
Copy link

jedie commented Aug 10, 2017

I also used $ curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 ... it worked, but pipsi env was made with python2 and not with python3 ;)

I made a simple sh script to install from git: https://gist.github.com/jedie/513d2f8415af0bebba70229d49f601b2

@brettcannon
Copy link

I had a problem today where I specified an installed Python 3.6 on macOS with the curl command and the shebang for pipsi wasn't set appropriately. I ended up manually editing the shebang to point to pipsi's own virtualenv python and everything seems to be working fine.

@elgertam
Copy link

elgertam commented Oct 29, 2017

I had quite a few problems getting Pipsi installed (Python 3.6.2 via Pyenv, macOS High Sierra). I first encountered errors because virtualenv was not installed. I attempted this suggestion (from #89)

curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src 'git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi'

and was able to install pipsi, but every subsequent package I attempted to install with pipsi (e.g.cookiecutter, pipenv, ansible) displayed the dreaded

Did not find any scripts. Uninstalling.

One solution might be to install virtualenv into my global site-packages. However, as a philosophical matter, I don't want to pollute my Python 3 global packages with virtualenv, since venv has been such a capable replacement. Maybe this is just hairsplitting, but it feels wrong to me, particularly because avoiding global site-packages pollution is a major use case for pipsi.

That led me to attempt a fork of @jedie's install script (https://gist.github.com/elgertam/2d50ea280d2395dd2bbedbb169c59d2e/cbc9f2132a945a2b7d44248f93eb749a6296830d) where I install virtualenv and pipsi into a virtualenv created with venv. Although I am able to install pipsi, I again experience the "Did not find any scripts" error for all packages I attempted to install.

I then revised the install script (https://gist.github.com/elgertam/2d50ea280d2395dd2bbedbb169c59d2e/0bba09f4ced1d702654fe51d5db75133a34749ef). Here I use a bootstrapping approach to first create a "bootstrapping" virtualenv via venv, into which I install virtualenv. Then I use this bootstrapping virtualenv to install pipsi into its own virtualenv using virtualenv. Finally, I clean up the bootstrapping virtualenv by removing it.

I mention this only as a way I was able to solve the problem. I haven't dug deep into the code to figure out why I was getting such bad behavior from pipsi under Python 3, but I have tested my installation pipsi against several packages, and all is working as I expect it to.

@wxiv
Copy link

wxiv commented May 3, 2018

@elgertam I tried using your script and it works with various packages (awscli) but I still get

Did not find any scripts. Uninstalling.

with boto3 and botocore.

@elgertam
Copy link

elgertam commented May 3, 2018

@wxiv I'm seeing the same problem.

I took a look at boto3 (and botocore), and these specify scripts=[] in setup() within setup.py. Here's boto3's:

https://github.com/boto/boto3/blob/1461984ff5cf03a789e7c46c0fac98cb0cc37cc7/setup.py#L35

In this case, pipsi really cannot find any scripts, and so is working as intended. I suppose someone could fork boto3 and specify the proper scripts location. Hope this helps somewhat.

@tekumara
Copy link

Unfortunately ran into the following with @elgertam's latest script:

Running virtualenv with interpreter python3
Using base prefix '/usr/local/bin/../Cellar/python/3.6.5/bin/../Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/tekumara/.local/venvs/pipsi/bin/python3
Also creating executable in /Users/tekumara/.local/venvs/pipsi/bin/python
ERROR: The executable /Users/tekumara/.local/venvs/pipsi/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6' (should be '/Users/tekumara/.local/venvs/pipsi')
ERROR: virtualenv is not compatible with this system or executable

@jedie's script installed, and I could install packages, but pipsi list and pipsi uninstall would fail with

FileNotFoundError: [Errno 2] No such file or directory: '/Users/tekumara/.local/venvs/pipsi/package_info.json'

@halicki
Copy link

halicki commented Jul 30, 2018

@jedie's script installed, and I could install packages, but pipsi list and pipsi uninstall would fail with

FileNotFoundError: [Errno 2] No such file or directory: '/Users/tekumara/.local/venvs/pipsi/package_info.json'

@tekumara you can follow instructions from this comment. You need to create package_info.json yourself :(

@EdJoJob
Copy link

EdJoJob commented Oct 23, 2018

Some of this is going to be down to virtualenv. See pypa/virtualenv#1051.

As far as I can tell you can reproduce this by:

  1. Create a python3 virtualenv using python3 -m venv <path>
  2. Try creating a new virtualenv based off the previous one with virtualenv virtualenv -p <path>/bin/python <new-path>

If both virtualenvs are created with either virtualenv or python -m venv it all works fine.

@cs01
Copy link
Contributor

cs01 commented Oct 23, 2018

Just wanted to mention that I was running into this too so I recently decided to start a project called pipx that combines pipsi's functionality with npx's. It works with Python versions 3.6+. Would love to hear what you think! https://github.com/cs01/pipx

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

No branches or pull requests

10 participants