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

zipimport.ZipImportError #1919

Closed
andy15703166 opened this issue Jul 10, 2014 · 24 comments
Closed

zipimport.ZipImportError #1919

andy15703166 opened this issue Jul 10, 2014 · 24 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@andy15703166
Copy link

When I run the command "python get-pip.py",It alerts that as below:

Traceback (most recent call last):
  File "../get-pip.py", line 17474, in <module>
    main()
  File "../get-pip.py", line 17466, in main
    bootstrap(tmpdir=tmpdir)
  File "../get-pip.py", line 17406, in bootstrap
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available

How to do that?Thank you!

@pfmoore
Copy link
Member

pfmoore commented Jul 10, 2014

Looks like your Python was built without zip support. Presumably it's a custom build? You need that support for get-pip to work.

@andy15703166
Copy link
Author

Yeah,my python is customly builded.
How to make it zip supported?

@andy15703166
Copy link
Author

Thank you,
I have made it!

@pfmoore
Copy link
Member

pfmoore commented Jul 10, 2014

As I guess you found out (just mentioning it here in case anyone later finds this issue when searching) you just need the relevant libraries available when building Python (I think it's just zlib, but I'm not completely sure on that)

@andy15703166
Copy link
Author

Yeah, you guess is right!
I post the method here how I get make this problem.Is it OK?

@andy15703166
Copy link
Author

1.Install the zlib the newest version
2.Then complie python again and run a line ./configure --prefix=/root/Python-2.7.8 --with-zlib-dir=/usr/local/lib

@pfmoore
Copy link
Member

pfmoore commented Jul 10, 2014

Fantastic, many thanks.

@Luis-Palacios
Copy link

can you elaborate more the solution? i am facing the same problem and when trying the command ./configure --prefix=/root/Python-2.7.8 --with-zlib-dir=/usr/local/lib i get unrecognized command --with-lib-dir

@hrdcore0x1
Copy link

I'm also getting the unrecognized command --with-lib-dir. Is there a workaround?

@Ivoz
Copy link
Contributor

Ivoz commented Sep 27, 2015

@hrdcore0x1 maybe you want --with-libs instead of --with-lib-dir

Make sure you have zlib (+development headers) package installed.

@hrdcore0x1
Copy link

Thank you, I got it working!
On Sep 27, 2015 3:17 PM, "Matt Iversen" [email protected] wrote:

@hrdcore0x1 https://github.com/hrdcore0x1 maybe you want --with-zlib-dir
instead of --with-lib-dir


Reply to this email directly or view it on GitHub
#1919 (comment).

@NivaldoTeixeira
Copy link

Where am I supposed to run the ./configure command? I keep getting "bash: ./configure: No such file or directory"

@Ivoz
Copy link
Contributor

Ivoz commented Oct 7, 2015

@NivaldoTeixeira directly inside the unzipped python sources folder. This is if you are building your python executable / installation from scratch. https://github.com/python/cpython/blob/master/configure is the file in SCM.

@xiaoliwe
Copy link

xiaoliwe commented Apr 8, 2016

hi andy , i got error msessage

[root@WE ~]# python get-pip.py 
Requirement already up-to-date: pip in /usr/python3.5/lib/python3.5/site-packages
[root@WE ~]# cd /usr/python3.5/lib/python3.5/site-packages
[root@WE site-packages]# ls -l
total 44
-rw-r--r--.  1 root root  126 Apr  8 08:07 easy_install.py
drwxr-xr-x.  3 root root 4096 Apr  8 08:07 _markerlib
drwxr-xr-x. 11 root root 4096 Apr  8 08:12 pip
drwxr-xr-x.  2 root root 4096 Apr  8 08:12 pip-8.1.1.dist-info
drwxr-xr-x.  4 root root 4096 Apr  8 08:07 pkg_resources
drwxr-xr-x.  2 root root 4096 Apr  8 08:07 __pycache__
-rw-r--r--.  1 root root  119 Apr  8 08:07 README
drwxr-xr-x.  4 root root 4096 Apr  8 08:07 setuptools
drwxr-xr-x.  2 root root 4096 Apr  8 08:07 setuptools-18.2.dist-info
drwxr-xr-x.  6 root root 4096 Apr  8 08:12 wheel
drwxr-xr-x.  2 root root 4096 Apr  8 08:12 wheel-0.29.0.dist-info
[root@WE site-packages]# pip -V
**-bash: pip: command not found**
[root@WE site-packages]# 

so , what's up ? i think that pip have already installed .

thanks a lot.

@Ivoz
Copy link
Contributor

Ivoz commented Apr 8, 2016

@winecos try python -m pip show -f pip

It will list all the files installed for pip, provided python can indeed find it. python -m pip is an alternate way of invoking pip, by the way. In that listing of files, likely at the top, you should be able to find listings of where pip's binaries are installed. Maybe they are somewhere that is not on your bash's PATH.

@jcmdln
Copy link

jcmdln commented Apr 8, 2016

To confirm that pip is in your path, you may also use which pip to
show where it's installed/referenced.

On Friday, April 8, 2016, Matt Iversen [email protected] wrote:

@winecos https://github.com/WinEcos try python -m pip show -f pip

It will list all the files installed for pip, provided python can indeed
find it. python -m pip is an alternate way of invoking pip, by the way.
In that listing of files, likely at the top, you should be able to find
listings of where pip's binaries are installed. Maybe they are somewhere
that is not on your bash's PATH.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#1919 (comment)

@leo0113
Copy link

leo0113 commented May 5, 2016

In the python source folder
./configure --prefix= --with-zlib-dir=/usr/local/lib
and
make && make install
Should be OK

@alanyee
Copy link
Contributor

alanyee commented Jun 23, 2016

$ ./configure --prefix= --with-zlib-dir=/usr/local/lib
configure: WARNING: unrecognized options: --with-zlib-dir

For me, it doesn't work.

@pr0head
Copy link

pr0head commented Jul 22, 2016

@cell13
Copy link

cell13 commented Aug 13, 2016

The error: zipimport.ZipImportError: can't decompress data; zlib not available
I meet the same problem while using the command "python get-pip.py".
python: 2.7.12
os: Centos 6.5

  1. I think that I must lose the module zlib. So, I using the command "yum install zlib-devel". I try the command "python get-pip.py" again. The problem is still be there.
  2. I try reinstall python again.
  3. I try the command "python get-pip.py" again. The problem is solved.
    thanks all !

@ljgww
Copy link

ljgww commented Sep 1, 2017

@andy15703166
"1.Install the zlib the newest version"
How to do this?

also

$ ./configure --prefix= --with-zlib-dir=/usr/local/lib
configure: WARNING: unrecognized options: --with-zlib-dir

btw

$ sudo yum install zlib
Loaded plugins: ulninfo
Setting up Install Process
Package zlib-1.2.3-29.el6.i686 already installed and latest version 
Nothing to do

What worked for me (@ vagrant oel65-i386-plain) was (not completely but at least killed zlib issue) was:

sudo yum install zlib-devel
./configure
make
sudo make install

python2.7 get-pip.py does not complain about zlib not being there (it complains now about SSL but that is not this story)

@justinsousa
Copy link

justinsousa commented Jan 4, 2018

^^ second that. zlib was installed but I got the above error when building pip. installing the devel package resolved the issue on RHEL 7

@tuanluu-agilityio
Copy link

tuanluu-agilityio commented Feb 26, 2019

You can follow here. It work fine for me.

@lock
Copy link

lock bot commented May 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests