Python Pygame OSx error relating to El Capitan System - python

I'm installing PyGame on to OSx ElCapitan with a System install of 2.7 and Brew install of Python3 following this blog post. The brew install Python3 worked fine with
sudo pip3 install hg+http://bitbucket.org/pygame/pygame
But
sudo pip install hg+http://bitbucket.org/pygame/pygame
runs into the following error
running install_headers
creating /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pygame
error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pygame': Operation not permitted
Rolling back uninstall of pygame
Command "/usr/bin/python -c "import setuptools, tokenize;
__file__='/tmp/pip-wepMKN-build/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-sWpHWA-record/install-record.txt
--single-version-externally-managed --compile"
failed with error code 1 in /tmp/pip-wepMKN-build
which I believe is related to the new System Integrity Protection in El Capitan. Everything was updated and doctored before so the system is running well otherwise.
Any help on how I can overcome this would be awesome and helpful to many I'm sure.
Thanks
Chris

#Arthur has provided a link to a thread on the possible solutions to this problem although I'm not sure I'm ready to turn off the SIP so personally would opt for the user only install suggested by a not approved answer on the aforementioned thread.

Related

Error when installing the package numcodecs. What do I do?

I ran this command:
pip install numcodecs
And I got this error:
Error: Command errored out with exit status 1: 'c:\users\sunit\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sunit\\AppData\\Local\\Temp\\pip-install-419pmst9\\numcodecs\\setup.py'"'"'; __file__='"'"'C:\\Users\\sunit\\AppData\\Local\\Temp\\pip-install-419pmst9\\numcodecs\\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\sunit\AppData\Local\Temp\pip-record-5lw96050\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\sunit\appdata\local\programs\python\python38\Include\numcodecs' Check the logs for full command output.
What do I do?
I had the same error (trying to install zarr module, with the error coming from installing numcodecs). I was able to resolve it by updating my OSX to the newest version (Catalina), which then led to me reinstalling anaconda, Xcode, and previous Python packages from scratch. After doing that,
pip install numcodecs
still failed with the same error. However,
conda install numcodecs
or in my case:
conda install zarr
worked without error. It seems to have something to do with a conflict between Xcode tools and pip installer, which conda overcomes. My colleague was likewise unable to install via pip but could install via conda and a virtual environment on the first try, a faster option to try first before reinstalling everything.
Brief discussion of the issue on Github here.

Installing pybluez using pip3

i am trying to install pybluez package using pip3. but i always get the following error, when I write to terminal "pip3 install pybluez"
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/_r/vshyh8x51h59xl0nks7jtz280000gn/T/pip-build-2gek1vzy/pybluez/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/_r/vshyh8x51h59xl0nks7jtz280000gn/T/pip-jiy18qdr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_r/vshyh8x51h59xl0nks7jtz280000gn/T/pip-build-2gek1vzy/pybluez/
So far I have only found that upgrading the 'setuptools' might help, but it did not. I have also installed xcode to my mac. So does anyone have any suggestions ?
Thanks in advance!
In the Ubuntu system, you might want to try using:
sudo apt-get install libbluetoothdev

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.

Trying to install wxPython Phoenix for python 3

When I tried to install wx Phoenix via pip with this command
pip3 install --upgrade --trusted-host wxpython.org --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
Well, after a long time trying to build it I get this error:
Command "/usr/local/bin/python3.4 -u -c "import setuptools, tokenize;
__file__='/tmp/pip-build-q1ih5z3f/wxPython-Phoenix/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-wygy2a7y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1
in /tmp/pip-build-q1ih5z3f/wxPython-Phoenix/
Anyone have the same problem? How I can fix this?
I suppose you are on a Unix plattform. In that case the command as entered by you will not find any wheel, download the source package and try to compile it. See in the README.txt what to do to get wxPython Linux wheels:
Wheels for Linux
----------------
Since there are various options for distro and wx port (GTK2 or GTK3) then the
files can not all be located in the same folder like we can do for the Windows
and OSX builds. This just simply means that you'll need to drill down a
little further to find the URL to give to pip. For example, to get the GTK3
Phoenix builds for Ubuntu 16.04 (and 16.10, LinuxMint 18, and probably others)
you can use a pip command like this:
pip install -U --pre \
-f https://wxpython.org/Phoenix/snapshot-builds/linux/gtk3/ubuntu-16.04 \
wxPython_Phoenix

How to fix netifaces module installation for python2.7?

Environment : Kali Linux 2
I started reading this book "Python network programming cookbook" and the writers listed few modules I am gonna need during the book i was able to install all of them except #netifaces, I tried both the "pip install netifaces" and "python setup.py install" methods but both made appear this message:
x86_64-linux-gnu-gcc: error trying to exec 'cc1': execvp: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-lsf_5N/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-TsHwUh-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-lsf_5N/netifaces
Storing debug log for failure in /root/.pip/pip.log
I tried to install python-dev and all the libraries I could find in previous asked questions here but nothing made it happen
Thank you all for your help
It looks like you are missing gcc, which is needed to compile netifaces.
I've never used Kali Linux before but you should have apt so, you can try: sudo apt-get install gcc to install the missing package.
Hopefully this solves your problem.

Categories

Resources