I'm seeing this weird issue on ec2. I'm trying to install lsm-db package inside my virtualenv, it says it's successfully installed but when trying to import the package or do pip list it's not there.
I created this virtualenv by
virtualenv -p python3.6 venv
source venv/bin/activate
then running which python and which pip shows the correct ones inside venv as <path-to-my-project>/venv/bin/pip. Then I run pip install -r requirements.txt where sqlalchemy and lsm-db are included. A warning is shown
WARNING: Building wheel for lsm-db failed: [Errno 13] Permission denied: '/home/ec2-user/.cache/pip'
WARNING: Building wheel for sqlalchemy failed: [Errno 13] Permission denied: '/home/ec2-user/.cache/pip'
Failed to build lsm-db sqlalchemy
Installing collected packages: sqlalchemy, flask-sqlalchemy, lsm-db, MarkupSafe, click
Running setup.py install for sqlalchemy ... done
Running setup.py install for lsm-db ... done
Successfully installed MarkupSafe-1.1.1 click-7.0 flask-sqlalchemy-2.4.0 lsm-db-0.6.4 sqlalchemy-1.3.5
The last line shows they are correctly installed despite the warnings. However, they are not. Running pip install lsm-db gives
▶ pip install lsm-db
WARNING: The directory '/home/ec2-user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/ec2-user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lsm-db
Downloading https://files.pythonhosted.org/packages/17/f2/dc68ecdece424eb206c42b8db924c5a7f6dd97d26df42a1c9fb41a6fe555/lsm-db-0.6.4.tar.gz (316kB)
|████████████████████████████████| 317kB 14.7MB/s
Building wheels for collected packages: lsm-db
WARNING: Building wheel for lsm-db failed: [Errno 13] Permission denied: '/home/ec2-user/.cache/pip'
Failed to build lsm-db
Installing collected packages: lsm-db
Running setup.py install for lsm-db ... done
Successfully installed lsm-db-0.6.4
Again it shows it's installed, but it's not. Not in pip list, can't import in Python. What is going on here? Why do I see permission issue inside virtualenv? I didn't create the virtualenv with sudo if that's a potential problem. Is it related to the way I installed virtualenv?
EDIT
I changed the permission and reinstall pip with sudo yum install python36-pip. Now I'm seeing this... sorry it seems like a new problem
Running setup.py install for lsm-db ... error
ERROR: Complete output from command /home/ec2-user/<project>/venv/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-bhhmd3j8/lsm-db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-__gotpo6/install-record.txt --single-version-externally-managed --compile --install-headers /home/ec2-user/<project>/venv/include/site/python3.6/lsm-db:
ERROR: /tmp/pip-install-bhhmd3j8/lsm-db/setup.py:11: UserWarning: Cython not installed, using pre-generated C source file.
warnings.warn('Cython not installed, using pre-generated C source file.')
running install
running build
running build_ext
building 'lsm' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -c lsm.c -o build/temp.linux-x86_64-3.6/lsm.o
lsm.c:32:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/home/ec2-user/<project>/venv/bin/python3.6 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-bhhmd3j8/lsm-db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-__gotpo6/install-record.txt --single-version-externally-managed --compile --install-headers /home/ec2-user/<project>/venv/include/site/python3.6/lsm-db" failed with error code 1 in /tmp/pip-install-bhhmd3j8/lsm-db/
EDIT
Thanks for the pointers, now I installed the python development package on ec2 and tried to install lsm-db again
> sudo yum install python36-devel
...
> pip install lsm-db
Collecting lsm-db
Using cached https://files.pythonhosted.org/packages/17/f2/dc68ecdece424eb206c42b8db924c5a7f6dd97d26df42a1c9fb41a6fe555/lsm-db-0.6.4.tar.gz
Building wheels for collected packages: lsm-db
Building wheel for lsm-db (setup.py) ... done
Stored in directory: /home/ec2-user/.cache/pip/wheels/ed/32/8a/b0f3aa15b68f1e6b8f2dcc6285de4796b6b58af71c5f280f48
Successfully built lsm-db
Installing collected packages: lsm-db
Successfully installed lsm-db-0.6.4
again, it shows it's successful, and which python gives me the right python in my venv. However, I have the exact same result as the beginning, pip list does not have lsm-db and I cannot import it in python.
This is entirely an issue on ec2, I can successfully use lsm-db in my virtualenv on my mac. There must be something off with virtualenv on ec2 here, why the right pip in venv cannot install a package in venv?? I'm completely lost. If anyone has experience please chime in!
(To work around this problem, I'm switching from lsm-db to sqlitedict in my code. sqlitedict can be installed no problem, so it narrows the suspect down to just lsm-db specific issues.)
This question from 2016 is more similar to mine but it has no conclusion why or any solution.
Pip says that pymongo has been installed, but doesn't show it as installed
Another potentially related question:
Amazon EC2 virtualenv: pip says it installed numpy but python can't find it
The problem seems to be with system file permissions. You can check the owner:group as well as rwx permissions for other users of the folder '/home/ec2-user/.cache/pip' from terminal using:
ls -lh /home/ec2-user/.cache/pip
In order to change the owner of the folder use command:
sudo chown -R ec2-user /home/ec2-user/.cache/pip
Another way to solve is to allow rwx permissions to all users by:
sudo chmod -R 777 /home/ec2-user/.cache/pip
Related
I'm trying to install ansible-pylibssh on an Apple Silicon based Mac.
ansible is already installed.
When running pip3 install ansible-pylibssh I get the following error:
pip3 install --user ansible-pylibssh 1 ✘ took 3s at 00:36:15
Collecting ansible-pylibssh
Using cached ansible-pylibssh-1.0.0.tar.gz (97 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ansible-pylibssh
Building wheel for ansible-pylibssh (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for ansible-pylibssh (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
[1/1] Cythonizing /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.pyx
running build_ext
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src
creating /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.c -o /private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/tmpa3ax4nf7/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.o
/private/var/folders/6l/48k83hdn30bc24655lbtzgx80000gn/T/pip-install-lme1njwa/ansible-pylibssh_0b7185d13e5244b3982c6d892f55319b/src/pylibsshext/_libssh_version.c:757:10: fatal error: 'libssh/libssh.h' file not found
#include "libssh/libssh.h"
^~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ansible-pylibssh
Failed to build ansible-pylibssh
ERROR: Could not build wheels for ansible-pylibssh, which is required to install pyproject.toml-based projects
However libssh is already installed:
brew install libssh
Warning: libssh 0.10.4 is already installed and up-to-date.
To reinstall 0.10.4, run:
brew reinstall libssh
I have tried reinstalling ansible, libssh, none of them worked.
I'm having the same problem as you, this issue was finally solved today.
When i manually building and installing from source, still run into this problem:
#include "libssh/libssh.h"
^~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
This is because the libssh library was not discovered by clang, so we manually added a softlink to solve it.
Find out the lib dir:
% clang -E -x c - -v < /dev/null
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
......
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
......
Create a softlink for libssh:
% cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
% sudo ln -s /opt/homebrew/Cellar/libssh/0.10.4/include/libssh/ libssh
Rebuilding and installing from source, Worked!
Install libssh:
brew install libssh
Use a python virtual environment :
python3 -m venv .venv
source .venv/bin/activate
EDIT:
Install with correct compiler flags:
CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh" pip install ansible-pylibssh
Thanks, #webknjaz!
OLD Additional steps not needed (preserved for history):
Install tox build tool:
pip install 'tox >= 3.19.0'
Build from source on ARM-based Macs, per the ansible-pylibssh docs:
#git clone https://github.com/ansible/pylibssh.git ~/src/github/ansible/pylibssh
# or, if you use SSH:
git clone ssh://git#github.com/ansible/pylibssh.git ~/src/github/ansible/pylibssh
cd ~/src/github/ansible/pylibssh
Use libraries installed by brew with clang:
export CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh"
Build ansible-pylibssh:
tox -e build-dists
Install built ansible-pylibssh wheel:
pip install ~/src/github/ansible/pylibssh/dist/ansible_pylibssh*.whl
Additional resources that lead to this answer:
Kristof Rado's answer
ansible/pylibssh GitHub issue 207 provides background on why this package is not available for macOS on ARM from PyPi (symlink/softlink to point to the libraries did not help. Correct compiler flags were the needed answer.)
If you prefer not to work with a virtual environment, this may work: replace pip commands python3 -m pip --user and python commands with python3.
The problem was with the package not my computer.
It seems that Github Actions are not available for ARM Macs so no dists were built for this platform.
Manually building and installing from source worked:
$ git clone https://github.com/ansible/pylibssh.git
$ cd pylibssh
$ pip install tox
$ tox -e build-dists
Installing:
cd dist
pip3 install ansible_pylibssh-1.0.1.dev47+g75289d4-cp39-cp39-macosx_12_0_arm64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./ansible_pylibssh-1.0.1.dev47+g75289d4-cp39-cp39-macosx_12_0_arm64.whl
Installing collected packages: ansible-pylibssh
Successfully installed ansible-pylibssh-1.0.1.dev47+g75289d4
When I running the command pip install allennlp, the output looks below. What is the meaning of Building wheel for xxx? What is the action behind Building wheel for xxx?
Building wheel for jsonnet (setup.py) ... done
Stored in directory: /Users/xu/Library/Caches/pip/wheels/f0/47/51/a178b15274ed0db775a1ae9c799ce31e511609c3ab75a7dec5
Building wheel for nltk (setup.py) ... done
Stored in directory: /Users/xu/Library/Caches/pip/wheels/97/8a/10/d646015f33c525688e91986c4544c68019b19a473cb33d3b55
Building wheel for parsimonious (setup.py) ... done
I've done some search and it seems wheel is a kind of files that help pip to set up the package, but I still have not a clear understanding. I know this question might be a silly question, it would be good to know the answer though.
I am assuming you have already caught up with documentation on:
The Wheel Packaging format and what the .whl file contains
Building a .whl file
Installing from Pypi
Running pip install allennlp with -vvv offers more insights related to your specific question:
Created temporary directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-install-leyfrduz
...
Created temporary directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv
Building wheel for jsonnet (setup.py) ... Destination directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv
Running command /Users/subhashb/.pyenv/versions/3.7.2/envs/test-env-dev/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-install-leyfrduz/jsonnet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv --python-tag cp37
running bdist_wheel
running build
running build_ext
c++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
core/desugarer.cpp:406:67: warning: unused parameter 'obj_level' [-Wunused-parameter]
AST* makeArrayComprehension(ArrayComprehension *ast, unsigned obj_level) {
...
writing manifest file 'jsonnet.egg-info/SOURCES.txt'
Copying jsonnet.egg-info to build/bdist.macosx-10.14-x86_64/wheel/jsonnet-0.12.1-py3.7.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-10.14-x86_64/wheel/jsonnet-0.12.1.dist-info/WHEEL
creating '/private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv/jsonnet-0.12.1-cp37-cp37m-macosx_10_14_x86_64.whl' and adding 'build/bdist.macosx-10.14-x86_64/wheel' to it
adding '_jsonnet.cpython-37m-darwin.so'
adding 'jsonnet-0.12.1.dist-info/LICENSE'
adding 'jsonnet-0.12.1.dist-info/METADATA'
adding 'jsonnet-0.12.1.dist-info/WHEEL'
adding 'jsonnet-0.12.1.dist-info/top_level.txt'
adding 'jsonnet-0.12.1.dist-info/RECORD'
removing build/bdist.macosx-10.14-x86_64/wheel
done
The pip package code that makes this beautiful process run is at github. And it eventually ends up making a call to jsonnet's Makefile to "build" the wheel
In short, picking the example of jsonnet, running pip install jsonnet does the following:
downloads the jsonnet.tar.gz to a local temporary folder
invokes a c++ command to compile .cpp files
builds _jsonnet.cpython-37m-darwin.so (which is the correct library format for my Mac OS machine)
records the wheel distribution info in jsonnet-0.12.1.dist-info (typically present in your virtual env)
This flow is for jsonnet, and it happens to be slightly complicated because jsonnet is ultimatly a C extension. But regular python packages will just have the source file(s) downloaded and installed in the virtualenv. You can walk the same path to understand what happens behind any package.
I have been trying to install python-MySQLdb on mac and I keep getting error. I have tried so many alternatives to pass that error.
sudo PATH=/usr/local/Cellar/mysql/bin/:$PATH pip install mysql-python
Password:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory '/Users/zuhairhallak/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zuhairhallak/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mysql-python
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 2.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-RtF2js/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-RtF2js/mysql-python/
I have also ran sudo -H pip install mysql-python and I got different error
13 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.15/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-install-3A8kOd/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/tmp/pip-record-TUb4up/install-record.txt --single-version-externally-managed --compile
Please try
brew install mysql
sudo -H pip install mysql-python
I went to the mysql_config file and opened it up
vi mysql_config
This was correct.
Create options:
Libs = "- L $ pkglibdir"
Libs = "$ libs -lmysqlclient -lssl -lcrypto"
ran this command in terminal
1. export LDFLAGS="-L/usr/local/opt/openssl/lib"
2. export CPPFLAGS="-I/usr/local/opt/openssl/include"
3. pip install mysql-python
I'm trying to install Neon, a machine learning package (http://neon.nervanasys.com/docs/latest/installation.html), after cloning the Github repository, cd'ing to the neon directory, and running the make command I am running into the following error:
^
In file included from /tmp/pip-build-2yDIC3/h5py/h5py/defs.c:279:0:
/tmp/pip-build-2yDIC3/h5py/h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/kurt/Documents/Python/neon/.venv2/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2yDIC3/h5py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ArslBc-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/kurt/Documents/Python/neon/.venv2/include/site/python2.7/h5py" failed with error code 1 in /tmp/pip-build-2yDIC3/h5py/
Makefile:115: recipe for target '.venv2/bin/activate' failed
make: *** [.venv2/bin/activate] Error 1
The error seems to be associated with h5py, which is a requirement. However, that appears to have been installed correctly:
kurt#kurt-ThinkPad:~$ sudo pip install h5py
The directory '/home/kurt/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kurt/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): h5py in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in /usr/local/lib/python2.7/dist-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from h5py)
I've also tried setting hard links to the "serial" postfixes of the lib names of hdf5, as described in https://github.com/NVIDIA/DIGITS/issues/156, but to no avail. Curiously, if I run the make command again, I don't get the same error message but the following:
kurt#kurt-ThinkPad:~/Documents/Python/neon$ make
make[1]: Entering directory '/home/kurt/Documents/Python/neon/loader'
Building bin/loader.so...
g++ -shared -o bin/loader.so -fPIC -Wall -Wno-deprecated-declarations -O3 -std=c++11 -DHAS_IMGLIB -DHAS_VIDLIB -DHAS_AUDLIB src/loader.cpp -I/usr/include/opencv -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lavutil -lavformat -lavcodec -lswscale
make[1]: Leaving directory '/home/kurt/Documents/Python/neon/loader'
It says "Leaving directory" without an explicit error message, but when I try to import neon modules I get ImportError: No module named neon... errors.
Any ideas on how to fix this?
Following Evert's suggestion (and reading the instructions more carefully), I installed libhdf5-dev from a .deb file from http://packages.ubuntu.com/trusty/amd64/libhdf5-dev/download. After this neon worked. (It has to be run from a virtual environment).
I use Mac (OS X 10.11.5). I want to install module pymssql for python.
In Terminal.app, I input sudo -H pip install pymssql, pip install pymssql, sudo pip install pymssql . But error occur.
The directory /Users/janghyunsoo/Library/Caches/pip/http or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory /Users/janghyunsoo/Library/Caches/pip or its parent directory is not owned by the current user and caching wheels has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pymssql
Downloading pymssql-2.1.2.tar.gz (898kB)
100% |████████████████████████████████| 901kB 955kB/s
Installing collected packages: pymssql
Running setup.py install for pymssql ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-KA5ksi/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-A3wRBy-record/install-record.txt --single-version-externally-managed --compile:
setup.py: platform.system() => 'Darwin'
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.libc_ver() => ('', '')
setup.py: Detected Darwin/Mac OS X.
You can install FreeTDS with Homebrew or MacPorts, or by downloading
and compiling it yourself.
Homebrew (http://brew.sh/)
--------------------------
brew install freetds
MacPorts (http://www.macports.org/)
-----------------------------------
sudo port install freetds
setup.py: Not using bundled FreeTDS
setup.py: include_dirs = ['/usr/local/include', '/opt/local/include', '/opt/local/include/freetds']
setup.py: library_dirs = ['/usr/local/lib', '/opt/local/lib']
running install
running build
running build_ext
building '_mssql' extension
creating build
creating build/temp.macosx-10.6-intel-2.7
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/opt/local/include -I/opt/local/include/freetds -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mssql.c -o build/temp.macosx-10.6-intel-2.7/_mssql.o -DMSDBLIB
_mssql.c:18924:15: error: use of undeclared identifier 'DBVERSION_80'
__pyx_r = DBVERSION_80;
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-KA5ksi/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-A3wRBy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-KA5ksi/pymssql/
The top voted solution did not work for me as brew did not link the older version of freetds on its own. I did this to solve the problem:
brew unlink freetds;
brew install freetds#0.91;
brew link --force freetds#0.91
I was able to work around this by reverting to an older version of FreeTDS through Homebrew before running the pip install.
brew unlink freetds; brew install homebrew/versions/freetds091
The solution was found by andrewmwhite at:
https://github.com/pymssql/pymssql/issues/432
Found Detailed and simple answer with step by step installation of pymssql on http://gree2.github.io/python/setup/2017/04/19/python-instal-pymssql-on-mac.
brew unlink freetds; brew install homebrew/core/freetds091
brew link --force freetds#0.91
pip install pymssql
Found a solution for pip/python2 & pip3/python3
Problem:
I was Unable to get a successful build from pip3 following #siva & #himanshu workaround works for python2 but not for python3.
pip3 install pymssql
..._mssql.c:21155:15: error: use of undeclared identifier 'DBVERSION_80'
__pyx_r = DBVERSION_80;
^
1 error generated.
error: command 'clang' failed with exit status 1
Your issue is not a permission issue, but, a code-compiling issue with dependent code for pymssql.
Here's the discussion,
Where I found the Solution on github.
It has been around for a while at this point, just placing here for visibility.
Just use the newest build of pymssql from gitub:
pip3 install git+https://github.com/pymssql/pymssql
Also works for python2
pip install git+https://github.com/pymssql/pymssql
OR
pip2 install git+https://github.com/pymssql/pymssql
I Tested on Mac OS X (10.13.6) & Homebrew (1.7.1-62-gddbefee) multiple times.
The command works for both versions of freetds (0.91) or (1.00.94)
"brew install homebrew/python/pymssql" also worked but will install older 2.1.1 as of today.
This worked for me on mac:
pip install cython
then
pip install git+https://github.com/pymssql/pymssql.git
All the solutions above work well . Just one word of caution , the setup.py for pymssql pip install pymssql expects that Homebrew has installed Freetds at /sw on your machine.
This was not the case in my machine so I had to use the work around here :
Manually download the .tar file for pymssql
Open setup.py
Edit the variable fink to add the path to where ever Freetds is actually installed on your machine.
if sys.platform == 'darwin':
fink = '<path to Freetds on your Machine>'
Then run python setup.py install