Pip install error on Mac for PyCryptodome - python

I've tried installing pycryptodome, pycrypto, and pycryptodomex and none of them seem to be downloading. I keep getting this pip install error:
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/var/folders/tn/c5hkkz_94rxfyghjrlzvj4nr0000gp/T/pip-build-Cl1sR8/pycryptodomex/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record /var/folders/tn/c5hkkz_94rxfyghjrlzvj4nr0000gp/T/pip-VrIJcG-record/install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
/private/var/folders/tn/c5hkkz_94rxfyghjrlzvj4nr0000gp/T/pip-build-Cl1sR8/pycryptodomex/
I'm using Mac OSX El Captain currently, I have python 2.7 and 3.5 installed, I'm hoping it will go to my python 3.5. I used the terminal command pip install pycryptodome and others switching the names out, none of them seem to work.

Related

Installing Scipy for Windows

I am trying to install Scipy on my computer. I did it by using the command pip install Scipy. (pip & numpy are up-to-date and I am using Python 3.6) I also tried it with Pycharm, but it didn't worked either.
I always do get this Error:
Command
"c:\users***\appdata\local\programs\python\python36\python.exe -u -c
"import setuptools,
tokenize;file='C:\Users\***\AppData\Local\Temp\pip-build-x3s21920\scipy\setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" install
--record C:\Users***\AppData\Local\Temp\pip-gr9ppj_q-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in C:\Users***\AppData\Local\Temp\pip-build-x3s21920\scipy\
Does anyone has an idea of what I can do?
Try to install it from the following binaries
http://www.lfd.uci.edu/~gohlke/pythonlibs/
These are unofficial precompiled binaries

How to install pymssql on MacOS Sierra

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-J1I0ox/pymssql/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-qmtdBW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/
I am having the same error as displayed here . I followed the instructions on that page by trying brew install freetds followed by sudo -H pip install pymssql.
That generates this error code:
_mssql.c:18814:15: error: use of undeclared identifier 'DBVERSION_80'
__pyx_r = DBVERSION_80;
^
4 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-J1I0ox/pymssql/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-qmtdBW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/
Searching this error brought me to this page. I followed the solution posted there by trying both brew unlink freetds; brew install homebrew/versions/freetds091 and brew uninstall freetds; brew install homebrew/versions/freetds091 which generates a different error when trying sudo -H pip install pymssql:
_mssql.c:266:10: fatal error: 'sqlfront.h' file not found
#include "sqlfront.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-0nUZo4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/
So then I gave up and tried to install pyodbc, but I still get similar errors: src/pyodbc.h:56:10: fatal error: 'sql.h' file not found
#include sql.h
Any help with this would be great.
This link ended up solving my problem. For anyone else having these issues, this sequence of commands worked for me.
brew uninstall --force freetds
brew install freetds#0.91
brew link --force freetds#0.91
pip install pymssql
As of Feb 2021
I can no longer install freetds#0.91 as homebrew does not have it available. The current version of freetds is 1.2.18 and brew link --force freetds doesn't seem to change anything.
The root issue 'sqlfront.h' file not found is due to the freetds files not linking properly during installation. We can fix this by doing
export LDFLAGS="-L/opt/homebrew/opt/freetds/lib"
export CPPFLAGS="-I/opt/homebrew/opt/freetds/include"
pip install pymssql
Where /opt/homebrew/opt/freetds is where homebrew installed freetds on your system (I am on Apple Silicon) and may be different for you. If you are on Intel your's might look something like /usr/local/opt/freetds.
To find exactly where homebrew installed freetds (or any program for that matter) on your system, you can do
brew --prefix freetds
This should return something like /opt/homebrew/opt/freetds or /opt/homebrew/opt/freetds#1.2.18. You can ignore any version numbers and append /lib and /include to get the paths you need.
This is a handy trick to keep in mind as it is applicable to lots of other install issues with dependencies installed via homebrew.

"pip install jq" generates errors on Mac and Windows

Duplicate of this issue, but the first answer there is wrong (jq is supported on Windows) and the second refers to brew so I'm guessing is for Mac.
Windows
I am trying to install jq for python from the Windows command line, but get the following errors, possibly due to a missing temp\pip-build-rtnhmg\jq\onig-install-5.9.6 file:
error: [Error 2] The system cannot find the file specified
... and ...
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\
Does anyone know what's gone wrong here? Searches on StackOverflow and Google aren't giving me much to go on, and I'm not great with Windows and still new to python/pip.
Here is the full text, minus username:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>pip install jq
Collecting jq
Using cached jq-0.1.6.tar.gz
Building wheels for collected packages: jq
Running setup.py bdist_wheel for jq ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\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 c:\users\<USERNAME>\appdata\local\temp\tmpuvrf_upip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\onig-install-5.9.6
error: [Error 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for jq
Running setup.py clean for jq
Failed to build jq
Installing collected packages: jq
Running setup.py install for jq ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\onig-install-5.9.6
error: [Error 2] The system cannot find the file specified
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\
Trying to install pyjq instead generates the same errors.
I'm not married to jq: I just need to format json data in python, and jq does a great job on the command line. If there are other python packages I should try instead, please feel free to recommend them. As mentioned above though, pyjq is failing install with the same errors.
Further details / steps taken:
I am on Windows 10 and have installed python 2.7.13, setuptools and pip using the steps from here ... no issues noted.
Using pip, I have successfully installed other python packages such as request and jira ... no issues noted.
Using chocolatey I have successfully installed jq for the command line, following these steps ... no issues noted.
I have tried using regular permissions, running cmd as administrator, starting a new cmd session, restarting the PC - but get the same errors.
Trying to install pyjq (pip install pyjq) generates the same errors.
Tried pip install jq on a Mac and got similar errors:
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-build-DyMoT4/jq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-i6UKvt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-build-DyMoT4/jq/
for the Mac, followed the steps suggested from here and successfully installed setuptools as suggested, but pip install jq still fails with the same error.
Installing via pip
As per jq installation steps for pip's project:
Installation requires any programs required to build jq. This includes:
Autoreconf
The normal C compiler toolchain, such as gcc and make.
libtool
Python headers.
macOS
On macOS, you need XCode to be installed, and the following packages:
brew install autoconf automake libtool
brew install jq
Linux
You need the following packages to be installed:
yum install autoconf automake libtool python

Fail to install objccheckstyle using pip in Mac OS X

I'm trying to install objccheckstyle with this command:
sudo pip install objccheckstyle
But it fails after it says
Running setup.py install for lxml
and I get this error:
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-DsaKIL/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-CFc6EG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-DsaKIL/lxml
I also tried sudo pip install lxml, but it looks like it fails when tries to import libxml:
#include "libxml/xmlversion.h"
I don't find libxml with pip install. What could I be missing?
Thanks
Updating to the latest Xcode's command line tools solved the problem.

Can't pip install anything requiring C compilation on OSX 10.10 with homebrew python

When I try to pip install things that involve C compilation (Pillow, specifically) I get an odd error:
clang: error: no such file or directory: 'Python.framework/Versions/2.7/Python'
error: command 'clang' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip_build_jakob/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip-LnL0hW-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/xt/f2d8vp4j65j2rt71pns6trjw0000gn/T/pip_build_jakob/Pillow
I posted my pip.log for this installation.
I think this problem is due to a combination of OSX 10.10 Yosemite and Homebrew python. Have you experienced this before? ideas on how to fix it?
You need to install XCode in order to be be able to compile on OS X.

Categories

Resources