Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgivens
7,484 PointsAn error occurred while installing requests!
I used pipenv to install requests as per the Introducing Pipenv course. The terminal returned an error. Does anyone know what is going on here? Thanks!
$ pipenv install requests
Installing requests…
Cannot fetch index base URL https://pypi.org/simple/
Could not find any downloads that satisfy the requirement requests in /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages
Downloading/unpacking requests
Cleaning up...
No distributions at all found for requests in /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages
Storing debug log for failure in /Users/brendhanpgivens/.pip/pip.log
Error: An error occurred while installing requests!
$ pipenv install matplotlib=2.2.2
Installing matplotlib=2.2.2…
⠋WARNING: Invalid requirement, parse error at "'=2.2.2'"
[brendhanpgivens@Stilton oo]$ pipenv install matplotlib==2.2.2
Installing matplotlib==2.2.2…
Downloading/unpacking matplotlib==2.2.2
Cannot fetch index base URL https://pypi.org/simple/
Could not find any downloads that satisfy the requirement matplotlib==2.2.2
Cleaning up...
No distributions at all found for matplotlib==2.2.2
Storing debug log for failure in /Users/brendhanpgivens/.pip/pip.log
Error: An error occurred while installing matplotlib==2.2.2!
$ pipenv install ipython
Installing ipython…
Cannot fetch index base URL https://pypi.org/simple/
Could not find any downloads that satisfy the requirement ipython in /Users/brendhanpgivens/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
Downloading/unpacking ipython
Cleaning up...
No distributions at all found for ipython in /Users/brendhanpgivens/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
Storing debug log for failure in /Users/brendhanpgivens/.pip/pip.log
Error: An error occurred while installing ipython!
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
1 Answer
Jeff Muday
Treehouse Moderator 28,720 PointsI haven't seen a problem like this, so I am just going to give you a few possibilities to try. You are probably not a beginner if you are interested in learning pipenv, that being said...
Try to hit the URL with a browser:
If your computer cannot resolve it correctly, you might have a networking issue. If it cannot neither pipenv nor traditional pip will be able to pull packages from Pypi. It can also be a proxy issue not allowing you to access that URL on your network.
It is possible that pip, virtualenv, or pipenv are not installed properly for the current user. Only a privileged user (like root) can install these programs at a system level since it modifies /usr/local/bin and /usr/local/lib; you might want to investigate if these are installed properly.
On Ubuntu Linux-- if one omits the "sudo" (super-user-do) you will get a bunch of errors with permissions. pipenv installation requires virtualenv, so you can accomplish the installation like this:
$ sudo apt install pip
$ sudo pip install pipenv
After that, you can create a directory and set up a clean virtualenv
$ mkdir test1
$ cd test1
$ pipenv clean
$ pipenv shell
Launching subshell in a virtual environment...
activate
(test1) $ python
Can you run a "pipenv shell" without an error? The shell needs to find the Pipfile and Pipfile.lock. When you see the (test1) before the $ prompt, you know that it is working properly.
You can also try to create a virtualenv manually
Since "pipenv" is a convenience utility, you should try to go "old-school" with just virtualenv and pip to install requests. I actually prefer using plain virtualenv as you have a totally separate environment and it is very clear where the python repl resides as well as the site packages etc.
see below:
$ mkdir test
$ cd test
$ virtualenv env
$ source env/bin/activate
(env) $ pip install requests
If you don't have any errors with the old-school approach, then it is an installation issue with pipenv.
I hope this helps.