Python : Can't install Pillow library on Pypy3.7 (7.3.1) - python

Pillow doesn't seem to install on Pypy3.7. I am running this on Mac OS, Catalina 10.15.4.
Pip3 install Pillow
returns:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/sg/g7xccd2d5ql7cv01qg_3j0440000gn/T/pip-install-6bmk1_j2/pillow/setup.py", line 918, in <module>
raise RequiredDependencyException(msg)
RequiredDependencyException:
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
Is there anything I am missing here? All I see is the missing 'Zlib'. I tried to
brew install Zlib
And reinstalled Xcode just in case. Nothing seems to work. The odd thing is that it works fine with python3 pip, but not with pypy3 pip.

Try to change CPATH:
export CPATH=`xcrun --show-sdk-path`/usr/include

Related

Why cant I import/use installed libraries in Python

I recently downloaded Python 3.10 because I used 3.9. At first, everything worked fine. Sadly, I can't use installed libraries nor use newly downloaded ones, since I deleted Python 3.9. What can I do about this problem?
VSCode gives me this Error message:
Traceback (most recent call last):
File "e:\XXXX\XXXX.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
You can check installed packages using this command:
pip freeze
or
pip list
Uninstall and install using command pip install <package-name>

DLL load failed: The specified module could not be found. File "<stdin>", line 1, in <module>

Installed anaconda 3 with python 3.7.1 and extracted openCV 3.4.5. Copied and renamed the cv2.cp37-win_amd64.pyd file from opencv(python3.7 folder) as cv2.pyd and pasted on Anaconda3/Lib/site-packages.
Tried installing opencv through anaconda navigator; installed visual C++ redistributable; tried through opencv-contrib-python; checked if the python3.dll is missing, but present. And none of these helped.
ImportError Traceback (most recent call last)
<ipython-input-2-252459bf3e0b> in <module>
----> 1 import cv2
ImportError: DLL load failed: The specified module could not be found.
I have seen some of these installation issues before and found the easiest solution to be pip. Instructions can be found here
If you already have pip installed, simply run pip install opencv-python from your command line. You may have to clean up some of your old installation attempts for this to work, but try it first and test it real quick with something like python -c "import cv2; print(cv2.__version__)". You should get something like 4.0.0 as a response.

importing pycurl with libcurl4 raises ImportError

I am using Ubuntu 18.04. If I install libcurl4 (instead of libcurl3), when I import pycurl installed with pipenv I get
>>> import pycurl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /home/pietro/envs/try_fabric-kcbGLH3z/lib/python3.6/site-packages/pycurl.cpython-36m-x86_64-linux-gnu.so)
Note that this error is raised only when I use a pycurl installed with pipenv or pip. If I use instead pycurl installed through apt on system python there are any errors...
What can I do to avoid this impasse?
I assume you upgraded your operating system recently.
pip stores a cache of built wheels in your home directory, when upgrading your os it is a good idea to clear this cache as the binaries may now link against incompatible system libraries
You can do this by rm -rf ~/.cache/pip and then recreate your environment

pip installing eyeD3 module. Failed to find libmagic

Trying to install eyed3 but it's giving me this error:
>>> import eyed3
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import eyed3
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\eyed3\__init__.py", line 35, in <module>
from .utils.log import log # noqa
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\eyed3\utils\__init__.py", line 27, in <module>
import magic
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\magic.py", line 176, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
Here's the pip install:
I tried to uninstall with pip and delete all the eyed3 files, then re-install and it still gave the same error. It also does the same thing with easy_install.
On Windows
You'll need DLLs for libmagic. #julian-r has uploaded a version of this project that includes binaries to pypi: https://pypi.python.org/pypi/python-magic-bin/0.4.14
pip install python-magic-bin==0.4.14
Works for me.
I fixed it by installing libmagic with this command
brew install libmagic
You need to install libmagic before you install eye3d.
Here is a link to the git.
https://github.com/ahupp/python-magic#dependencies
You can use this to install it:
pip install python-magic

Install MySQLdb with Anaconda

I "successfully" installed MySQLdb using:
pip install mysql-python
But when I use the terminal to check, "import MySQLdb" throws this error:
Traceback (most recent call last):
File "", line 1, in
File "//anaconda/lib/python2.7/site-packages/MySQLdb/init.py", line 19, in
import _mysql
ImportError: dlopen(//anaconda/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: //anaconda/lib/python2.7/site-packages/_mysql.so
Reason: image not found
I'm assuming this is due to some issue with linking, but I don't know what to do.
--- I'm on a Mac. ---
MYsql-python is a wrapper around MySQL client libraries. Here, you seem to lack SSL libraries. Try installing libssl (if you're on a Debian/Ubuntu/Mint)
sudo apt-get install libssl1.0.0

Categories

Resources