How to install scikit-image? - python

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.

Related

Errors when installing packages in Dockerfile (to run pythoscript with cron)

I have to schedule the execution of a python script within a docker container. My script uses several packages that I have to install, so this is my Dockerfile:
FROM python:3.9.0b4-alpine3.12
COPY AzureVM /bin/AzureVM
COPY root /var/spool/cron/crontabs/root
RUN pip install azure-common
RUN pip install azure-mgmt-compute
RUN pip install msrestazure
RUN pip install paramiko
RUN chmod +x /bin/AzureVM
CMD crond -l 2 -f
When I try to build the container, it gets huge errors for some of the packages (more specifically msrestazure and paramiko). For example:
Step 6/8 : RUN pip install msrestazure
---> Running in f02284bb6aee
Collecting msrestazure
Downloading msrestazure-0.6.4-py2.py3-none-any.whl (40 kB)
Requirement already satisfied: msrest<2.0.0,>=0.6.0 in /usr/local/lib/python3.9/site-packages (from msrestazure) (0.6.19)
Collecting adal<2.0.0,>=0.6.0
Downloading adal-1.2.4-py2.py3-none-any.whl (55 kB)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from msrestazure) (1.15.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (2020.6.20)
Requirement already satisfied: requests-oauthlib>=0.5.0 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (1.3.0)
Requirement already satisfied: requests~=2.16 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (2.24.0)
Requirement already satisfied: isodate>=0.6.0 in /usr/local/lib/python3.9/site-packages (from msrest<2.0.0,>=0.6.0->msrestazure) (0.6.0)
Collecting python-dateutil>=2.1.0
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting PyJWT>=1.0.0
Downloading PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
Collecting cryptography>=1.1.0
Downloading cryptography-3.1.tar.gz (534 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-8e8f308c/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
cwd: None
Complete output (37 lines):
Collecting setuptools>=40.6.0
Downloading setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting cffi!=1.11.3,>=1.8
Downloading cffi-1.14.3.tar.gz (470 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5nw42fq5/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5nw42fq5/cffi/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 /tmp/pip-pip-egg-info-l9k0d28w
cwd: /tmp/pip-install-5nw42fq5/cffi/
Complete output (23 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-5nw42fq5/cffi/setup.py", line 163, in <module>
ask_supports_thread()
File "/tmp/pip-install-5nw42fq5/cffi/setup.py", line 81, in ask_supports_thread
config.try_compile('__thread int some_threadlocal_variable_42;'))
File "/usr/local/lib/python3.9/distutils/command/config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "/usr/local/lib/python3.9/distutils/command/config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "/usr/local/lib/python3.9/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/local/lib/python3.9/distutils/unixccompiler.py", line 117, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
File "/usr/local/lib/python3.9/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/usr/local/lib/python3.9/distutils/spawn.py", line 74, in spawn
proc = subprocess.Popen(cmd, env=env)
File "/usr/local/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gcc'
----------------------------------------
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 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-8e8f308c/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install msrestazure' returned a non-zero code: 1
I tried to change the base image (slim, buster, slim-buster) and all the packages were installed, but then I got the following error every time:
Crond not found
When I try to schedule a simple script (without any strange installs) it works fine (only with python:3.9.0b4-alpine3.12). I don't know what to do, so please help!
Add this before running pip commands.
RUN apk add build-base libffi-dev openssl-dev --no-cache
Tested below Dockerfile. Rest steps you can add accordingly.
FROM python:3.9.0b4-alpine3.12
RUN apk add build-base libffi-dev openssl-dev --no-cache
RUN pip install azure-common \
&& pip install azure-mgmt-compute \
&& pip install msrestazure \
&& pip install paramiko

Installing OpenCV fails because it cannot find "skbuild"

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

I'm having trouble downloading the slycot library using terminal via pip

So I'm trying to download slycot via pip and I keep getting errors. To be completely honest I'm not totally familiar with terminal prompts and how all that works. Here is what I'm getting when I run, sudo -H pip3 install slycot
Here is what terminal publishes with that command:
Collecting slycot
Using cached https://files.pythonhosted.org/packages/ae/9d/7ed3f2abf08aab0be9ac2b67e3040c20d9c594cce6a4af2203da0c28a6c4/slycot-0.3.5.0.tar.gz
Installing build dependencies ... done
Missing build requirements in pyproject.toml for slycot from https://files.pythonhosted.org/packages/ae/9d/7ed3f2abf08aab0be9ac2b67e3040c20d9c594cce6a4af2203da0c28a6c4/slycot-0.3.5.0.tar.gz#sha256=cad98d5ea4f0a034cf398c39189f587620a0b03f1d4b71e77cd622a327f13adf.
The project does not specify a build backend, and pip cannot fall back to setuptools without 'setuptools>=40.8.0' and 'wheel'.
Getting requirements to build wheel ... error
Complete output from command /Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpz94vocr1:
Traceback (most recent call last):
File "setup.py", line 25, in <module>
from skbuild import setup
ModuleNotFoundError: No module named 'skbuild'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
return hook(config_settings)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/build_meta.py", line 130, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/build_meta.py", line 112, in _get_build_requires
self.run_setup()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/build_meta.py", line 211, in run_setup
self).run_setup(setup_script=setup_script)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/build_meta.py", line 126, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 28, in <module>
raise ImportError('sckit-build must be installed before running setup.py')
ImportError: sckit-build must be installed before running setup.py
----------------------------------------
Command "/Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpz94vocr1" failed with error code 1 in /private/tmp/pip-install-t9m8s8yp/slycot
You are using pip version 19.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I've now tried pip install scikit-build and this returns
Requirement already satisfied: scikit-build in /Library/Python/3.7/site-packages (0.10.0)
Requirement already satisfied: packaging in /Library/Python/3.7/site-packages (from scikit-build) (20.1)
Requirement already satisfied: setuptools>=28.0.0 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-build) (40.8.0)
Requirement already satisfied: wheel>=0.29.0 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-build) (0.33.1)
Requirement already satisfied: pyparsing>=2.0.2 in /Library/Python/3.7/site-packages (from packaging->scikit-build) (2.4.6)
Requirement already satisfied: six in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages (from packaging->scikit-build) (1.12.0)
You are using pip version 19.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I've also tried, pip install cmake and this returns
Requirement already satisfied: cmake in /Library/Python/3.7/site-packages (3.16.3)
You are using pip version 19.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Any help would be appreciated.
You have another error with the installation of slycot, you have a dependency on skbuild.
In order to fix it check this site that gives you the compiled binaries to the skbuild package and try again [and maybe cmake as well]
Try this
pip install scikit-build; pip install cmake
You can read here for more details and ways to make this work.
Not able to install skbuild

How to install Paramiko on my Mac OS X 10.11

I tried to install paramiko on my Mac OS X 10.11
sudo pip install paramiko
Password:*******
then I got
The directory '/Users/bheng/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/bheng/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 paramiko
Downloading paramiko-2.0.2-py2.py3-none-any.whl (171kB)
100% |████████████████████████████████| 174kB 6.7MB/s
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from paramiko)
Collecting cryptography>=1.1 (from paramiko)
Downloading cryptography-1.5.2-cp27-cp27m-macosx_10_10_intel.whl (2.4MB)
100% |████████████████████████████████| 2.4MB 568kB/s
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Collecting setuptools>=11.3 (from cryptography>=1.1->paramiko)
Downloading setuptools-28.0.0-py2.py3-none-any.whl (467kB)
100% |████████████████████████████████| 471kB 2.7MB/s
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=1.1->paramiko)
Collecting idna>=2.0 (from cryptography>=1.1->paramiko)
Downloading idna-2.1-py2.py3-none-any.whl (54kB)
100% |████████████████████████████████| 61kB 10.4MB/s
Collecting ipaddress (from cryptography>=1.1->paramiko)
Downloading ipaddress-1.0.17-py2-none-any.whl
Collecting enum34 (from cryptography>=1.1->paramiko)
Downloading enum34-1.1.6-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Library/Python/2.7/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko)
Installing collected packages: setuptools, idna, ipaddress, enum34, cryptography, paramiko
Found existing installation: setuptools 1.1.6
Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/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 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
What did I do wrong?
Try sudo chown $(whoami) /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/
Then do the same for any directories that Python doesn't have permissions for.
Recent versions of OSX and macOS have a system called System Integrity Protection that means that some directories don't have user permissions. This is in order to prevent the possibility of malware controlling system-central directories, such as /System and /tmp.
EDIT
pip install --user paramiko installs the library under the user directory, meaning you won't have problems with permissions. There are other ways to fix this issue with Python consistently, see the comments on this post for more.
First install paramiko using pip. Navigate to terminal and type –
$ pip install paramiko
To install paramiko library under user directory, use the below command
$ pip install --user paramiko
Even after this if you get error like “module not found” you can try the below command,
Use pip3 to install Python 3 modules.
$ sudo -H pip3 install paramiko --ignore-installed
$ sudo -H pip install paramiko --ignore-installed
Source: https://thenucleargeeks.com/2019/08/08/installing-paramiko-in-mac/

Python: Matplotlib Install Issues

I have mac OSX 10.7.5 and I'm trying to install matplotlib, but I keep having issues.
Kristas-MacBook-Pro:lib Krista$ brew install matplotlib
==> Installing matplotlib dependency: numpy
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading https://downloads.sourceforge.net/project/numpy/NumPy/1.8.1/nump
Already downloaded: /Library/Caches/Homebrew/numpy-1.8.1.tar.gz
==> Downloading https://pypi.python.org/packages/source/n/nose/nose-1.3.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/numpy--nose-1.3.1.tar.gz
==> python setup.py install --prefix=/usr/local/Cellar/numpy/1.8.1 --single-vers
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
https://github.com/homebrew/homebrew-python/issues
I'm not sure what to do? I tried brew doctor etc, as suggested by that website, but am just lost. Any help?
When trying to install distribute I get this error (and when trying to upgrade setuptools, I also get it)
Kristas-MacBook-Pro:lib Krista$ pip install distribute
Downloading/unpacking distribute
Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
Running setup.py (path:/private/var/folders/1z/b3f7sbv11gv2jvy113vy8m180000gn/T/pip_build_Krista/distribute/setup.py) egg_info for package distribute
Downloading/unpacking setuptools>=0.7 (from distribute)
Downloading setuptools-5.4.1-py2.py3-none-any.whl (528kB): 528kB downloaded
Installing collected packages: setuptools, distribute
Found existing installation: setuptools 0.6c12dev-r85381
Uninstalling setuptools:
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1431, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 598, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1836, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 295, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 293, in move
OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/easy_install.py'
Storing debug log for failure in /Users/Krista/Library/Logs/pip.log
You need to update setuptools (https://pypi.python.org/pypi/setuptools) or install Distribute (https://pypi.python.org/pypi/distribute/0.7.3)

Categories

Resources