Why fatal error: 'yaml.h' file not found when installing PyYAML? - python

I'm trying out downloading PyYAML and install it following the instructions here http://pyyaml.org/wiki/PyYAML
So I downloaded the ZIP package: http://pyyaml.org/download/pyyaml/PyYAML-3.11.zip and then cd into that folder and run python setup.py --with-libyaml install, the error message I got is ext/_yaml.h:2:10: fatal error: 'yaml.h' file not found
But I checked the PyYAML-3.11 folder, the yaml.h is there...
UPDATE: I tried the methods here http://sandlininc.com/?p=500
$ sudo easy_install pip
$ brew install libyaml
$ sudo easy_install setuptools
$ pip install -U PyYAML
Then I tried the python setup.py --with-libyaml install again. I got the message error: /Library/Python/2.7/site-packages/_yaml.so: Permission denied
Did I miss anything? Why the permission was denied? Thank you!

You can solve the issue by reinstalling the pyyaml package after adding required dependent libraries. Following are the steps:
Uninstall pyyaml
pip uninstall pyyaml
Install below packages
apt-get install libyaml-dev libpython2.7-dev
Install pyyaml again
pip install pyyaml

In MacOS the following solved the problem:
pip3 uninstall PyYaml
pip3 install PyYaml==5.2

Related

ERROR: No .egg-info directory found in C:\Users\Shreya Gupta\AppData\Local\Temp\pip-pip-egg-info-uoj9me_o

Getting this error while installing librosa:
ERROR: No .egg-info directory found in C:\Users\Shreya Gupta\AppData\Local\Temp\pip-pip-egg-info-uoj9me_o
I have tried the following things:
Upgrading the setup tools: pip install --upgrade setuptools pip
For installing I have tried the following methods:
pip install librosa
Using source:
tar xzf librosa-VERSION.tar.gz
cd librosa-VERSION/
python setup.py install
pip install git+https://github.com/librosa/librosa
Nothing seems to be working. Getting the same error as above mentioned in all the installation methods.
Solution that worked - Using conda "conda install -c conda-forge librosa" to install worked fine.

Unable to install pip because my Mac has python 2.7 by default

I'm currently trying to download pip onto my python 3.9.6 I had downloaded off the official website, but my Macbook (version 10.15.6 Catalina) returns the line:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
So I then tried installing python3 using the post Getting an error installing pip in my Mac which said to run the line:
$ python3 --version
Python 3.7.0
which installed python3 for me, and running $ python3 --version afterwards shows that I have Python 3.8.2 installed now. Yet then running the line returns that I can't install the packages due to:
$ pip3 install --upgrade pip Collecting pip
Using cached https://files.pythonhosted.org/packages/47/ca/f0d790b6e18b3a6f3bd5e80c2ee4edbb5807286c21cdd0862ca933f751dd/pip-21.1.3-py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'RECORD'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Can anyone help me with this error? My account is an admin account already so I'm confused by what it means by check the permissions.
You don't have permission to install packages globally. Either use Sudo, or install for the current user only, as suggested in the command output you posted.
sudo pip3 install <package>
or
pip3 install --user <package>

Installing pycurl with 'fatal error: gnutls/gnutls.h: No such file or directory'

I use ubuntu 16.04 and python 2.7.12.
When I try to install pycurl with pip, I could see below log.
aaa#bbb:~/git/ccc$ sudo pip install pycurl
Downloading pycurl-7.43.0.tar.gz (182kB)
100% |████████████████████████████████| 184kB 515kB/s
Installing collected packages: pycurl
Running setup.py install for pycurl ... error
...
In file included from src/docstrings.c:4:0:
src/pycurl.h:173:30: fatal error: gnutls/gnutls.h: No such file or directory
compilation terminated.
How to install pycurl with above log?
Install gnutls first using:
sudo apt-get install libgnutls28-dev
Then try again.
I found the answer by myself.
Need to install libgnutls28-dev like below first.
sudo apt-get install libgnutls28-dev

No such file or directory: '/usr/local/bin/pip'

I had pip installed earlier on my OSX, but its not working somehow. So, i was trying to install pip again, using the command :
sudo easy_install pip
But it gives me the error as below :
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
error: [Errno 2] No such file or directory: '/usr/local/bin/pip'
I am neither able to use pip, nor install it.
Just run:
$ hash -r
in bash and it will be solved.
In my case, I had to upgrade pip from 22.1.2 to 22.2.1:
pip3 install --upgrade pip
I solved it by removing the pip file in /usr/local/bin and reinstalling pip.
My solution to the "No such file or directory" error was to add to $PATH the directory, where the 'pip' (and 'pip3') commands are installed. In your case such directory might be '/usr/local/bin/pip'.
Find your pip binary using this:
which pip or which pip3.7
then copy to below path:
sudo cp /home/LOGGED_USER/.local/bin/pip3.7 /usr/bin/pip3.7
In my case I was using python3 pip but the working command was pip3

Can't install pycurl with pip

Can't install pycurl with pip, win xp x32, python 2.7.
here is the log
pip install pycurl
Downloading/unpacking pycurl
Downloading pycurl-7.19.3.1.tar.gz (116Kb): 116Kb downloaded
Running setup.py egg_info for package pycurl
Please specify --curl-dir=/path/to/built/libcurl
Complete output from command python setup.py egg_info:
Please specify --curl-dir=/path/to/built/libcurl
----------------------------------------
Command python setup.py egg_info failed with error code 10 in C:\Documents and S
ettings\User\build\pycurl
Storing complete log in C:\Documents and Settings\User\Application Data\pip\pi
p.log
Following the steps one mentioned above, solved my problem.
sudo apt install libcurl4-gnutls-dev librtmp-dev
pip install pycurl
This is a problem indeed. No need to update pip or easy install as it's often advised, well it won't hurt to update but you will still have the problem until you :
install libcurl4-gnutls-dev librtmp-dev packages
pip install pycurl
Worked the same in Linux
I had the same problem. I was able to install it with easy_install instead:
easy_install pycurl
For easy_install, see setuptools.
Here are easy steps I did to get around this:
Download the wheel of the version you want here: https://www.lfd.uci.edu/~gohlke/pythonlibs/
then you can pip install that like so:
pip install C:\sample\sample_dir\whl_file_downloaded
You should know be able to import in your python files
install pycurl using conda, conda will install all dependencies, Hope it works
conda install -c anaconda pycurl
steps to follow :
brew install openssl
PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl
For Linux Please install the libcurl-devel package and then try. It will work.
So has said by Hai Vu you need to install cURL first.
Here is the dowload page : http://curl.haxx.se/download.html
I suggest you install it in your C:/ directory, or if you already installed it elsewhere copye the curl.exe file to your c:/
When done, you can try it by going to the cmd prompt :
cd c:/
curl "your-curl-request"
If it works then curl is correctly installed and you can install pycurl with pip.

Categories