I have a docker image that I need to install openCV in it and from yesterday it started to fail because it cannot find the "skbuild" module:
Step 12/24 : RUN pip install opencv-python opencv-contrib-python
---> Running in a0f746a23aed
Collecting opencv-python
Downloading https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz (88.9MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-cciracwm/opencv-python/setup.py", line 9, in <module>
import skbuild
ModuleNotFoundError: No module named 'skbuild'
And on the host also I cannot find that module and pip search is either return nothing or returns a server error:
sudo pip3 search skbuild
WARNING: The directory '/home/ali/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 216, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 60, in run
pypi_hits = self.search(query, options)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 80, in search
hits = pypi.search({'name': query, 'summary': query}, 'or')
File "/usr/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python3.6/xmlrpc/client.py", line 1452, in __request
verbose=self.__verbose
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/network/xmlrpc.py", line 45, in request
return self.parse_response(response.raw)
File "/usr/lib/python3.6/xmlrpc/client.py", line 1342, in parse_response
return u.close()
File "/usr/lib/python3.6/xmlrpc/client.py", line 656, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32403: 'server error; service unavailable'>
Is this because their server has some problems or it is related to my pip?
Update
I tried it on different python and pip versions, python versions 3.6 and 3.7 and pip version 19.12 and 20.2.2 and 9.0.1 (the one inside image).
Update 2
I added pip install scikit-build one step before opencv installation but I get another error related to cmake:
Step 12/25 : RUN pip install scikit-build
---> Running in afe0c5c0fca0
Collecting scikit-build
Downloading https://files.pythonhosted.org/packages/78/c9/7c2c7397ea64e36ebb292446896edcdecbb8c1aa6b9a1a32f6f67984c3df/scikit_build-0.11.1-py2.py3-none-any.whl (72kB)
Collecting packaging (from scikit-build)
Downloading https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Requirement already satisfied: wheel>=0.29.0 in /usr/lib/python3/dist-packages (from scikit-build)
Collecting distro (from scikit-build)
Downloading https://files.pythonhosted.org/packages/25/b7/b3c4270a11414cb22c6352ebc7a83aaa3712043be29daa05018fd5a5c956/distro-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=28.0.0; python_version >= "3" in /usr/lib/python3/dist-packages (from scikit-build)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from packaging->scikit-build)
Collecting pyparsing>=2.0.2 (from packaging->scikit-build)
Downloading https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67kB)
Installing collected packages: pyparsing, packaging, distro, scikit-build
Successfully installed distro-1.5.0 packaging-20.4 pyparsing-2.4.7 scikit-build-0.11.1
Removing intermediate container afe0c5c0fca0
---> 533658ddf26d
Step 13/25 : RUN pip install opencv-python opencv-contrib-python
---> Running in 0f2c03bc042a
Collecting opencv-python
Downloading https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz (88.9MB)
Collecting opencv-contrib-python
Downloading https://files.pythonhosted.org/packages/48/98/05bd8e00c71b66c4e7847cc051cac404191d904df58b51a7dcc3767ff747/opencv_contrib_python-4.2.0.34-cp37-cp37m-manylinux1_x86_64.whl (34.2MB)
Collecting numpy>=1.14.5 (from opencv-python)
Downloading https://files.pythonhosted.org/packages/3d/d1/90cd7e0b27ee86d77f5386d38b74520486100286d50772377791b6ef22ff/numpy-1.19.1-cp37-cp37m-manylinux1_x86_64.whl (13.4MB)
Building wheels for collected packages: opencv-python
Running setup.py bdist_wheel for opencv-python: started
Running setup.py bdist_wheel for opencv-python: finished with status 'error'
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w49xv99a/opencv-python/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 /tmp/tmpycj03zlwpip-wheel- --python-tag cp37:
/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
Failed building wheel for opencv-python
Running setup.py clean for opencv-python
Failed to build opencv-python
Installing collected packages: numpy, opencv-python, opencv-contrib-python
Found existing installation: numpy 1.13.3
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Running setup.py install for opencv-python: started
Running setup.py install for opencv-python: finished with status 'error'
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w49xv99a/opencv-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 /tmp/pip-maky1uyw-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Problem with the CMake installation, aborting build. CMake executable is cmake
If you read the opencv-python package FAQ in PyPI, it clearly provides an answer for this specific issue: you must run pip install --upgrade pip. Check pip version afterwards with pip -V.
This is because your pip is too old to understand the new manylinux2014 package format and tries to compile from source. That will also fail because pip is too old to understand how to use pyproject.toml to install build dependencies such as scikit-build.
Another issue I'm spotting is that you install both opencv-python and opencv-contrib-python. You should not do this. It's also explained in the PyPI page of the packages. Most likely you should be using just opencv-contrib-python-headless package since you are using Docker and I assume you do not use the GUI functionalities of OpenCV.
just update the pip and it will work
python -m pip install --upgrade pip
Just update pip.
If you use python3 then:
pip3 install --upgrade pip
pip3 install opencv-python
skbuild is for Scikit-build.
Install it using pip:
As for windows: pip install scikit-build
After the succesfull installation:
pip install cmake
Since I have python3 installed, I had to use
python3 -m pip install --upgrade pip
11/may/2021: faced same issue on a fresh ubuntu18 virtualbox image. this worked for me
sudo -H pip3 install --upgrade pip
pip3 install opencv-python
I also had the error, in my case when executing
python3.7 -m pip install --user opencv-python in order to get catkin_make -j8 working again in a ROS project. Thus, Docker is not needed to get the error.
First the details:
Collecting opencv-python
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/30/46/821920986c7ce5bae5518c1d490e520a9ab4cef51e3e54e35094dadf0d68/opencv-python-4.4.0.46.tar.gz (88.9MB)
100% |████████████████████████████████| 88.9MB 17kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-8jky5692/opencv-python/setup.py", line 9, in <module>
import skbuild
ModuleNotFoundError: No module named 'skbuild'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8jky5692/opencv-python/
Just documenting what I did to solve it:
python -m pip install --user opencv-python gives me /usr/bin/python: No module named pip
sudo apt install python-pip (in addition to the already existing sudo apt install python3-pip installation for pip3)
python -m pip -V now gives me pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
pip -V gives me pip 20.3.3 from /home/MYUSERNAME/.local/lib/python3.6/site-packages/pip (python 3.6) (because apt-get installs a standard 3.6, independently from existing python versions)
sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3.7-dev zlib1g-dev (not sure if this step is needed)
pip install opencv-python WORKING
catkin_make -j8 in my catkin workspace in the Python base environment WORKING
Additional hints for the cmake error that is mentioned in the Update 2
This cmake error is perhaps due to a corrupted workspace during or after catkin_make install:
I had a similar cmake error when I executed the catkin_make command inside my Python virtual environment. When I changed back to the base environment (using deactivate), catkin_make ran through. This is probably due to dependency issues in the virtual environment, perhaps also because of the version that is used when you use standard python -m that is used by some internal scripts, see one of the bullet points above. I had to assign python2.7 to the python -m pip -V pip version, probably because ROS gazebo needed 2.7.
Most promising (if this is a catkin issue): simply remove catkin and install it again, see Error 2 Invoking "make -j4 -l4" failed.
Perhaps also see Invoking "cmake" failed.
I had a similar problem and what finally worked was to change from python:3-alpine to python:3.8-slim and install python and openCV similar to what has been done in the selected answer here: Minimal SciPy Dockerfile
If non of these answers works for you try:
pip3 install opencv-python-headless
with python3 you need to use pip3
Related
I 've a running Django project created with poetry I 'm trying to install its dependencies using poetry install using python 3.9`
I 'm getting this error while installing
cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-req-build-1hvchk7d\
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
WARNING: Discarding file:///C:/Users/Lenovo/AppData/Local/pypoetry/Cache/artifacts/0c/05/66/5aa05d2bdbafe6e3783cd138cb601eb252fdcfc29ba618431cd24deeaa/drf-access-policy-1.3.0.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 22.3.1 is available.
You should consider upgrading via the 'C:\Users\Lenovo\AppData\Local\pypoetry\Cache\virtualenvs\vending-machine-api-l-EiZrwy-py3.9\Scripts\python.exe -m pip install --upgrade pip' command.
at ~\.poetry\lib\poetry\utils\env.py:1101 in _run
1097│ output = subprocess.check_output(
1098│ cmd, stderr=subprocess.STDOUT, **kwargs
1099│ )
1100│ except CalledProcessError as e:
→ 1101│ raise EnvCommandError(e, input=input_)
1102│
1103│ return decode(output)
1104│
1105│ def execute(self, bin, *args, **kwargs):
I 've tried these solution but none worked for me :
pip install --upgrade pip
pip install --upgrade wheel
pip install setuptools
I am trying to install PyInstaller and I keep getting this error when I try to use pip. I am running Linux Mint 19.1.
elijah#elijah-HP-Laptop-15-bs1xx:~$ pip install pyinstaller
Collecting pyinstaller
Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-cMtlUT/pyinstaller/
elijah#elijah-HP-Laptop-15-bs1xx:~$
I think you don't have setuptools yet. You can try to install it first.
pip install setuptools
Or this one for your linux.
sudo apt-get install -y python-setuptools
Its scikit-image Download says:
pip install -U scikit-image
or
easy_install -U scikit-image
but both fail, regardless of the flag U, as shown below:
Georgioss-MacBook-Pro:Downloads gsamaras$ sudo pip install scikit-image
The directory '/Users/gsamaras/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/gsamaras/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 scikit-image
Downloading scikit_image-0.12.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (22.2MB)
100% |████████████████████████████████| 22.2MB 53kB/s
Requirement already satisfied: dask[array]>=0.5.0 in /Library/Python/2.7/site-packages (from scikit-image)
Collecting six>=1.7.3 (from scikit-image)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting networkx>=1.8 (from scikit-image)
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 133kB/s
Requirement already satisfied: pillow>=2.1.0 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: numpy; extra == "array" in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from dask[array]>=0.5.0->scikit-image)
Requirement already satisfied: toolz>=0.7.2; extra == "array" in /Library/Python/2.7/site-packages (from dask[array]>=0.5.0->scikit-image)
Collecting decorator>=3.4.0 (from networkx>=1.8->scikit-image)
Downloading decorator-4.0.10-py2.py3-none-any.whl
Installing collected packages: six, decorator, networkx, scikit-image
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-qlMJKP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Georgioss-MacBook-Pro:Downloads gsamaras$
and:
Georgioss-MacBook-Pro:Downloads gsamaras$ sudo easy_install scikit-image
Searching for scikit-image
Reading https://pypi.python.org/simple/scikit-image/
Best match: scikit-image 0.12.3
Downloading https://pypi.python.org/packages/86/d0/b0192dc9a544da90f2d9150bcd84b981c6873e42a1f752b6affb89180ad8/scikit-image-0.12.3.tar.gz#md5=04ea833383e0b6ad5f65da21292c25e1
Processing scikit-image-0.12.3.tar.gz
Writing /tmp/easy_install-X6Pjoh/scikit-image-0.12.3/setup.cfg
Running scikit-image-0.12.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-X6Pjoh/scikit-image-0.12.3/egg-dist-tmp-lHJxkL
Killed: 9
Notice that brew also fails, it cannot find it.
I have Python 2.7.10, Matplotlib 1.3.1, PIL 3.4.2 and Scipy '0.18.1'. What to do?
It's generally a bad idea to install libraries on your system-wide Python. Use a virtualenv for each project instead.
First install virtualenv globally on your Mac:
$ [sudo] pip install virtualenv
Then use virtualenv command to create a new (a copy) of Python executable:
$ cd your/prefred/folder
$ virtualenv your_project
Activate the virtualenv:
$ source your_project/bin/activate
Your virtualenv is created and activated (the prompt is changed to show the activation). You can install anything in it:
$ pip install -U scikit-image
pip install scikit-image
pip install --upgrade scikit-image
to call use skimage
(Entering this as an answer so as to include the error message).
Using the first answer from #Krackle I got the following (confusing) output which I am adding here to help others:
pip install skimage
Collecting skimage
Using cached skimage-0.0.tar.gz (757 bytes)
ERROR: Command errored out with exit status 1:
command: /opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ft/7j605bsd10l0ftqygyxjjflh0000gq/T/pip-install-xtxr1328/skimage/setup.py'"'"'; __file__='"'"'/private/var/folders/ft/7j605bsd10l0ftqygyxjjflh0000gq/T/pip-install-xtxr1328/skimage/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/ft/7j605bsd10l0ftqygyxjjflh0000gq/T/pip-pip-egg-info-q8dwl8rl
cwd: /private/var/folders/ft/7j605bsd10l0ftqygyxjjflh0000gq/T/pip-install-xtxr1328/skimage/
Complete output (3 lines):
*** Please install the `scikit-image` package (instead of `skimage`) ***
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I then used #Krackle's second command which (so far) has solved the problem.
I'm using Linux AMI on Amazon EC2 and I would like to install numpy and scipy. In theory, it should be quite straightforward, but I'm runnign into problems.
Here are my steps:
> sudo alternatives --set python /usr/bin/python3.4
> sudo virtualenv -p python3.4 my_env
> sudo chmod -R 777 my_env
> . my_env/bin/activate
> pip install numpy
Installing numpy returns:
Collecting numpy
Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy
Running setup.py install for numpy
Successfully installed numpy
But it does not seems to work, because running pip freeze and pip list does not show any trace of numpy. The fact that I'm missing the package is obvious when I try to run pip install scipy:
Collecting scipy
Using cached scipy-0.16.1.tar.gz
Collecting numpy>=1.6.2 (from scipy)
Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy, scipy
Running setup.py install for numpy
ImportError: No module named 'numpy' Running setup.py install for scipy
Complete output from command /usr/lib/python3.4/my_env/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-wq1cn43p/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mjftl3bs-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/lib/python3.4/my_env/include/site/python3.4/scipy:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 253, in <module>
setup_package()
File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 241, in setup_package
from numpy.distutils.core import setup
ImportError: No module named 'numpy'
I have the lastest pip version, 7.1.2.
When you set up your virtualenv to use python3 you also have to use pip3
virtualenv -p python3.4 env
source env/bin/activate
pip3 install numpy
In the terminal I run this command:
Python pnot.py
I get the following error:
Traceback (most recent call last):
File "pnot.py", line 1, in <module>
from APNSWrapper import *
ImportError: No module named APNSWrapper
I have tried to install the module:
pip install APNSWrapper==0.6.1
Requirement already satisfied (use --upgrade to upgrade): APNSWrapper==0.6.1 in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.3 in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages (from APNSWrapper==0.6.1)
Cleaning up...
I have tried to install APNS:
Pip install apns
I get the following error:
Downloading/unpacking apns
Downloading apns-1.1.2.tar.gz
Running setup.py egg_info for package apns
Installing collected packages: apns
Running setup.py install for apns
error: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: Permission denied
Complete output from command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip-3yfn_n-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib
copying apns.py -> build/lib
running install_lib
copying build/lib/apns.py -> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
byte-compiling /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/apns.py to apns.cpython-33.pyc
error: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: Permission denied
----------------------------------------
Cleaning up...
Command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip-3yfn_n-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_s/apns
Storing complete log in /Users/s/.pip/pip.log
script code:
from APNSWrapper import *
wrapper = APNSNotificationWrapper('cert.pem', True)
for token in ['xxxxxxx']:
token = binascii.unhexlify(token)
apn = APNSNotification()
apn.token(token)
alert = APNSAlert()
alert.body('hello world')
apn.alert(alert)
apn.sound()
wrapper.append(apn)
wrapper.notify()
This is really frustrating me, not sure why the script is not executing.
Most likely pip and python point to different Python installations. One might be from package manager, one might be from the system defaults.
You can find this out by doing commands
which python
which pip
Probably pip installs packages against some other python installation you are trying to use.
The solution to the problem, no matter how it has manifested itself, is to use virtualenv environments for your Python package installations. virtualenv creates a self-contained folder containing the python interpreter and package installations, which you can wipe clean and rebuild in the case of problems.
First install virtualenv.
Then do:
virtualenv venv # Create virtualenv installation in folder called venv
source venv/bin/activate # Modify your shell and PATH to use python from venv/bin/python
pip install apns # Installs apns in venv/lib
python pnot.py # Now it runs your script using venv/bin/python interpreter
# and packages installed in venv/lib/python2.7
More information about python and virtualenv installations
http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/