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

Matplotlib 2.0.0b3 wheel can't load libpng in OS X 10.6 #6945

Closed
aivarannamaa opened this issue Aug 14, 2016 · 13 comments
Closed

Matplotlib 2.0.0b3 wheel can't load libpng in OS X 10.6 #6945

aivarannamaa opened this issue Aug 14, 2016 · 13 comments

Comments

@aivarannamaa
Copy link

I installed matplotlib to Python 3.5 on OS X 10.6 with "pip install --pre matplotlib", ran following code

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()

and got

Traceback (most recent call last):
  File "/Users/aivar/Downloads/makinggames/plo.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/colorbar.py", line 36, in <module>
    import matplotlib.contour as contour
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/contour.py", line 23, in <module>
    import matplotlib.text as text
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/text.py", line 33, in <module>
    from matplotlib.backend_bases import RendererBase
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/backend_bases.py", line 63, in <module>
    import matplotlib.textpath as textpath
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/textpath.py", line 20, in <module>
    from matplotlib.mathtext import MathTextParser
  File "/Users/aivar/.thonny/lib/python/site-packages/matplotlib/mathtext.py", line 62, in <module>
    import matplotlib._png as _png
ImportError: dlopen(/Users/aivar/.thonny/lib/python/site-packages/matplotlib/_png.cpython-35m-darwin.so, 2): Symbol not found: _inflateReset2
  Referenced from: /Users/aivar/.thonny/lib/python/site-packages/matplotlib/.dylibs/libpng16.16.dylib
  Expected in: /usr/lib/libz.1.dylib
 in /Users/aivar/.thonny/lib/python/site-packages/matplotlib/.dylibs/libpng16.16.dylib
@jenshnielsen
Copy link
Member

@matthew-brett Do you have any insight into this? It looks like zlib on 10.6 is too old to have the relevant symbols defined

@matthew-brett
Copy link
Contributor

Can reproduce, will try building a new zlib in the wheel build recipe.

@matthew-brett
Copy link
Contributor

OSX 10.6 has zlib 1.2.3:

$ otool -L /usr/lib/libz.dylib 
/usr/lib/libz.dylib:
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

inflateReset2 added in zlib 1.2.4 - from : http://zlib.net/

Version 1.2.4 has many changes over 1.2.3, including these improvements:
    [snip]
    Added inflateReset2() and inflateMark() functions, the latter to aid in random access applications 

travis-ci has OSX 10.9, which has zlib 1.2.5, so libpng compiles expecting 1.2.5 and then barfs when it tries to load the symbol from 1.2.3.

I tried building matplotlib on OSX with an up-to-date copy of zlib. @aivarannamaa - does this work for you?

curl -LO https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com/matplotlib-2.0.0b3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
pip install matplotlib-2.0.0b3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

etc. If so I'll upload these to pypi for more testing.

@aivarannamaa
Copy link
Author

This wheel seems to be for Python 2.7. Could you also create one for Python 3.5?

I tried to install it to 2.7 but building a dependency (subprocess32) failed because I don't have build tools on my virtual OS X 10.6 (And I don't want to install them in order to keep the machine fresh for testing my app.)

@matthew-brett
Copy link
Contributor

Oh - dear - sorry about subprocess2 - I'll investigate.

But - there are already Python 3.5 wheels at the same location - could you try that?

@aivarannamaa
Copy link
Author

Great success!
Python 3.5 wheel works!

@matthew-brett
Copy link
Contributor

Great - thanks for testing.

I've uploaded the new wheels to pypi. Can you try again, to check it is working from pypi?

pip install --pre matplotlib

@tacaswell
Copy link
Member

Closing this as it looks like @matthew-brett resolved it by uploading new wheels to pypi.

@aivarannamaa
Copy link
Author

aivarannamaa commented Aug 16, 2016

Funny, after installing from pypi I still get the same error.

I started with pip3 uninstall matplotlib.

Then I did pip3 install --pre matplotlib but it wasn't good because it took the wheel from pip's cache.
I uninstalled again and did pip3 install --pre --no-cache-dir matplotlib. This time I saw it was downloading the wheel:


Collecting matplotlib
  Downloading matplotlib-2.0.0b3-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.7MB)
    100% |████████████████████████████████| 12.7MB 1.9MB/s 
Requirement already satisfied (use --upgrade to upgrade): cycler>=0.10 in ./.thonny/lib/python/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pytz in ./.thonny/lib/python/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in ./.thonny/lib/python/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in ./.thonny/lib/python/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10 in ./Desktop/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pyparsing!=2.0.0,!=2.0.4,!=2.1.2,>=1.5.6 in ./.thonny/lib/python/site-packages (from matplotlib)
Installing collected packages: matplotlib
Successfully installed matplotlib-2.0.0b3

After this I still got loading error mentioned above.

I tried also pip3 install --pre --no-cache-dir --upgrade matplotlib but the result was the same.

@matthew-brett
Copy link
Contributor

Thanks very much for testing.

So, what I did was upload new builds of matplotlib with a new "build tag" in their name. The new wheels have names like this:

matplotlib-2.0.0b3-1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

where -1- is the build tag. It looks like pip is still trying to get the older versions without the build tag. I've deleted these from pypi just now, and with this:

pip install --no-cache-dir --pre matplotlib

I now get the right wheel. I think the cached pypi listing times out after a while, so this should be the default in due course (without --no-cache-dir). Does this work for you now?

@aivarannamaa
Copy link
Author

Now it works!

@matthew-brett
Copy link
Contributor

Excellent - thanks for your persistence.

@aivarannamaa
Copy link
Author

aivarannamaa commented Aug 16, 2016

Thanks for your persistence :)

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

4 participants