Cannot install netCDF4 python package on OS X - python

I'm trying to install netCDF4 on OS X with pip install netCDF4 and I am getting the following error:
------------------------------------------------------------
/usr/local/bin/pip run on Wed Aug 7 23:02:37 2013
Downloading/unpacking netCDF4
Running setup.py egg_info for package netCDF4
HDF5_DIR environment variable not set, checking some standard locations ..
checking /Users/mc ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
Complete output from command python setup.py egg_info:
HDF5_DIR environment variable not set, checking some standard locations ..
checking /Users/mc ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4
Exception information:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 256, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1042, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 236, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4
I already installed HDF5 to /usr/local/hdf5/ but I'm still getting the same error. I'm a new to Python so any help will be greatly appreciated.
Thank you.

You might need to set the HDF5_DIR environment variable to the location where you install HDF5; it's looking in the standard install paths and not finding the headers for HDF5 - hence at least one of your errors.
You can simply set it before calling pip:
HDF5_DIR=/usr/local/hdf5 pip install netCDF4
or export it and then call pip:
export HDF5_DIR=/usr/local/hdf5
pip install netCDF4

Simply try this procedure to install netCDF4
install HDF5 from link
install netcdf4 from link
install netcdf4-python from link
For detail visit link

If you don't need the latest version --prefer-binary flag to pip may solve it:
pip install netcdf4 --prefer-binary

Related

Version conflict issue with Python packaging module

I was deploying OpenStack Newton devstack using stack.sh
I ran into the following issue :
Processing /opt/stack/requirements
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-2UrvLp-build/setup.py", line 29, in <module>
pbr=True)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 320, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 386, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2318, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (packaging 16.7 (/opt/stack/requirements/.venv/lib/python2.7/site-packages), Requirement.parse('packaging>=16.8'))
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-2UrvLp-build/
+inc/python:pip_install:1 exit_trap
+./stack.sh:exit_trap:487 local r=1
++./stack.sh:exit_trap:488 jobs -p
+./stack.sh:exit_trap:488 jobs=
+./stack.sh:exit_trap:491 [[ -n '' ]]
+./stack.sh:exit_trap:497 kill_spinner
+./stack.sh:kill_spinner:383 '[' '!' -z '' ']'
+./stack.sh:exit_trap:499 [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:500 echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:501 generate-subunit 1486635146 55 fail
+./stack.sh:exit_trap:502 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:505 /home/demo/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2017-02-09-101322.txt for details
+./stack.sh:exit_trap:511 exit 1
Looks like there is a version conflict for a package called 'packaging'.
Here's what I did - > Tried uninstall and re-installing the package by doing the following :
pip uninstall packaging
pip install --upgrade packaging
But it doesn't really help and I get the same error again.
Please help me resolve this issue, kindly be specific which command I should execute and in which directory.
I got the exact same error with devstack, here's how to fix it:
First add a global setting to log everything pip is doing. Create /etc/pip.conf with the following contents:
[global]
log = /var/log/pip.log
Then run:
sudo touch /var/log/pip.log
sudo chmod a+rw /var/log/pip.log
to make sure pip can always write to this file.
Then watch the changes related to the packaging package with:
tail -f /var/log/pip.log |grep packaging
And in parallel relaunch ./stack.sh .
At some point, in the pip logs you should see a line similar to:
Setting packaging===16.7 (from -c /opt/stack/requirements/upper-constraints.txt ...
This shows you where this requirement comes from, in this case it is from the /opt/stack/requirements/upper-constraints.txt file.
You can then manually edit the file in question to change this requirement to remove the conflict. In my case, I replaced:
packaging===16.7
by
packaging>=16.8
in /opt/stack/requirements/upper-constraints.txt
And after that the devstack installation completed without issues.
TL;DR
cd /opt/stack/requirements/
sed -i.bak s/packaging===16.7/packaging>=16.8/g upper-contraints.txt
try below commands
pip install --upgrade pip
pip install -r requirements.txt

Command "python setup.py egg_info" failed with error code 1

Extracting in C:\Users\hkpra\AppData\Local\Temp\tmp3esvodcb
Traceback (most recent call last):
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hkpra\AppData\Local\Temp\pip-build-imphcwak\unroll\setup.py", line 2, in <module>
ez_setup.use_setuptools()
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 125, in _do_download
_build_egg(egg, tarball, to_dir)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 99, in _build_egg
_extractall(tar)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 467, in _extractall
self.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\hkpra\AppData\Local\Temp\pip-build-imphcwak\unroll\
These are the things you need to do to fix this error when installing python. Make sure to follow in accordance.
check if PIP and setuptools are installed.
upgrade PIP and setuptools.
install ez_setup.
Should you want step by step guidance on how to go about it, you can go here.
install python again, then successed
I also install by pip,lick
pip install locustio
or
sudo pip install locustio
but error occur
Collecting locustio
Using cached locustio-0.7.5.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
error: Invalid distribution name or version syntax: locustio-0.7.5
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/yw/15gswkd13v37xjqjy66rc8xc0000gn/T/pip-build-hFFjxs/locustio/
I try pip, pip3, and so on. Finally, I install python again and then it is ok.
for python2.7
sudo pip install python
for python3
sudo pip install python3

pip - unable to find vcvarsall.bat

From last week, I tried to solve this but couldn't fix this error. While, I tried to install, following error comes:
C:\Users\#######>pip install pyproj
Collecting pyproj
Using cached pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
using bundled proj4..
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\H~1\AppData\Local\Temp\pip-build-e4o66o1z\pyproj\setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "C:\Users\######\Anaconda3\lib\distutils\_msvccompiler.py", line 317, in compile
self.initialize()
File "C:\Users\########\Anaconda3\lib\distutils\_msvccompiler.py", line 210, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\#######\Anaconda3\lib\distutils\_msvccompiler.py", line 85, in _get_vc_env
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\H~1\AppData\Local\Temp\pip-build-e4o66o1z\pyproj\
I couldn't proceed ahead without fixing this error. I have installed Microsoft Visual C++.
Installing some Python packages under Windows can be troublesome. You can find a precompiled package at
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyproj
Just download the .whl file that suits your Python version then install it using
pip install <filename>.whl

trouble with pip and easy_install to install python packages

I am going to install numpy library as a *.whl file, as numpy-1.9.2rc1+mkl- cp27-none-win32, on my Windows 7 machine...
Here is my approaches to do that, are which pip and easy_install packages...
The odd thing is that both don't work in the case of either Python 3.4 or Python 2.7...
Here are the trace of the attempts in the command prompt:
pip:
"C:\Users\Matinking\Desktop\numpy- 1.9.2rc1+
mkl-cp27-none-win32.whl" f
Exception:
Traceback (most recent call last):
File "c:\python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "c:\python34\lib\site-packages\pip\commands\install.py", line 257, in r
InstallRequirement.from_line(name, None))
File "c:\python34\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "c:\python34\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667
in parse
reqs = list(parse_requirements(s))
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605
in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "c:\python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2573
in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', ' C:\\Users\\Matinking\\Desktop\\numer
performance.pdf', 'at', ':\\Users\\Matinking\\Desktop\\numericperformance.pdf'
Storing debug log for failure in C:\Users\Matinking\pip\pip.log
and easy_install:
C:\Python34\Scripts>easy_install.exe "C:\Users\Matinking\Desktop\numpy- 1.9.2rc1+
mkl-cp27-none-win32.whl"
Processing numpy-1.9.2rc1+mkl-cp27-none-win32.whl
Writing C:\Users\MATINK~1\AppData\Local\Temp\easy_install- jr2ijafr\numpy\setup.c
fg
Running numpy\setup.py -q bdist_egg --dist-dir C:\Users\MATINK~1\AppData\Local\T
emp\easy_install-jr2ijafr\numpy\egg-dist-tmp-umy5kseg
This is the wrong setup.py file to run
No eggs found in C:\Users\MATINK~1\AppData\Local\Temp\easy_install-jr2ijafr\nump
y\egg-dist-tmp-umy5kseg (setup script problem?)
Any idea for the problem?!
You should upgrade your pip to version 6.0, the .whl file you're using isn't compatible with earlier versions.
To bump up your pip version on Windows :
python -m pip install -U pip
pip error -> why were you running an install on a pdf? That was never going to work.
easy_install error -> looks like you downloaded a python 2.7 binary and tried to install into a python 3.4 installation.
For scientific stack python, you are hard pressed to beat an Anaconda python distribution.

Installing Python Packages - IronPython

I'd like to add the PRAW package to an IronPython solution in VS however it's proving to be a pain in the butt. Here are steps I'm taking
right-click on IronPython Environment, select install python package.
type in "Praw" using pip
I get a prompt telling me that pip needs to get installed.
I then see the following:
Installing 'pip' package manager.
Downloading distribute from https://go.microsoft.com/fwlink/?LinkID=306663
Installing from distribute-0.6.45
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at c:\program files (x86)\ironpython 2.7\lib\site-packages\setuptools-0.6c11-py2.7.egg
Egg installation
Already patched.
running install
Traceback (most recent call last):
File "setup.py", line 147, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\core.py", line 151, in setup
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 952, in run_commands
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 971, in run_command
File "c:\users\mj\appdata\local\temp\ptvs-9jvsvw-pip_downloader\distribute-0.6.45\setuptools\command\install.py", line 63, in run
AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\pip_downloader.py", line 47, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\subprocess.py", line 512, in check_call
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\IronPython 2.7\\ipy64.exe', 'setup.py', 'install']' returned non-zero exit status 1
'pip' failed to install. Exit code: 1
With the reason for the failed install being: AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
How do I get around this? Is there a way to install pip and for ironpython in a different manner? Is there a way to install packages/libraries by not having to use pip? I can install the package just fine via Pip for python 2.7.
You have to run IronPython with the command line option -X:FullFrames. I'm not sure, though, how to set that up in the VS.
Maybe you can manually run it:
C:\path\to\ipy64.exe -X:FullFrames path\to\pip.py install whaterver_you_want

Categories