You mention --with-zlib
, but did you install the development headers from zlib-devel
(or zlib-dev
depending on your distro) before that? Install the headers and run the build again. Also, I recommend you install readline-devel
and openssl-devel
too.
Unable to install requests with pip in virtual ennvironment built using pyvenv-3.4
-
20-07-2023 - |
Question
I have installed virtual environment using pyvenv-3.4 it didn't install pip and I am unable to install any modules into virtual environment
(py34devel) x@x-Latitude-E6400:~/venv/py34devel$ ls bin
activate activate.csh activate.fish python python3 python3.4
If I use pip it falls back on the default pip which is outside the virtual environment and tells that requirement already satisfied
(py34devel) x@x-Latitude-E6400:~/venv/py34devel$ pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local
/lib/python2.7/dist-packages
Cleaning up...
I have installed Python3.4 prior to this using make altinstall and then I am trying to install requests.
Then I tried to download and run get-pip.py but it gave below error
(py34devel) x@x-Latitude-E6400:~/venv/py34devel$ python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20479, in <module>
main()
File "get-pip.py", line 20471, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 20411, in bootstrap
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
So I reconfigured Python3.4 with --with-zlib and installed it again but I get the same error
I tried to create virtual environment using virtualenv -p python3.4 but it again give zlib error
x@x-Latitude-E6400:~/venv$ virtualenv -p python3.4 phere
Running virtualenv with interpreter /usr/local/bin/python3.4
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 17, in <module>
import zlib
ImportError: No module named 'zlib'
Could anyone please help to resolve this issue.
I need to install a virtual environment which has python3.4 and pip so I may install modules, the documentation says that pip is install by default but that is not the case here
Unless the --without-pip option is given, ensurepip will be invoked to bootstrap pip
into the virtual environment.
I am didn't give --without-pip option but still pip isn't installed in the virtual environment
Please donot ask me to use python brew as I want to get this resolved either using pyvenv-3.4 or virtualenv
I also tried to install virtualenv using python2.7 and then installed python3.4 suing the --prefix=path_to_virtual_environment which did install python3.4 and the virtual environment had requests installed but python3.4 wouldn't import requests. It would give error that no module named requests exists.
Solution