Issue
I'm a newbie in Python
, coming from R
, and I'm not a programmer, so please be patient if my question is quite silly or trivial, but I cannot find a solution by myself.
I'm using Python 3.7
in Spyder, in a Windows 10 machine.
I'm following this tutorial, and I've understood that I need the scikit-image
module.
I've learned that external package should be imported in the same environment of Spyder, so I'm installing them from Spyder:
! pip install scikit-image
And I got this:
Requirement already satisfied: scikit-image in c:\users\me\appdata\local\programs\python\python37-32\lib\site-packages (0.15.0) ...
Same for pillow, networkx, PyWavelets, imageio, decorator, numpy (those I suppose they're the dependencies modules). It seems I've what I need.
So I try the first command of the above mentioned tutorial, that is:
from skimage import data
But the results seems this:
Traceback (most recent call last):
File "", line 1, in from skimage import data
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\skimage__init__.py", line 124, in _raise_build_error(e)
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\skimage__init__.py", line 104, in _raise_build_error %s""" % (e, msg))
ImportError: cannot import name 'geometry' from 'skimage._shared' (C:\Users\me\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\skimage_shared__init__.py) It seems that scikit-image has not been built correctly.
But I think that this is important:
Your install of scikit-image appears to be broken. Try re-installing the package following the instructions at: https://scikit-image.org/docs/stable/install.html
So I went to that link, but the standard installation is what I tried to do. What am I doing wrong?
Thanks in advance
EDIT1: I've followed the answer, I've run this:
!pip uninstall scikit-image --yes
Uninstalling scikit-image-0.15.0:
Successfully uninstalled scikit-image-0.15.0
Then
!pip install scikit-image
And the result is that is already satisfied
:
Requirement already satisfied: scikit-image in c:\users\me\appdata\local\continuum\anaconda3\lib\site-packages (0.15.0)
And same for:matplotlib, networkx, pillow, imageio, PyWavelets, numpy, cycler, kiwisolver, pyparsing,python-dateutil, decorator, six, setuptools
EDIT2:, done in the anaconda prompt, already some package are already satisfied, so I restarted Spyder, and sending:
from skimage import data
Gives a different error:
Traceback (most recent call last):
File "", line 1, in from skimage import data
File "C:\Users\me\AppData\Local\Continuum\anaconda3\Lib\site-packages\skimage__init__.py", line 127, in from .util.dtype import (img_as_float32,
File "C:\Users\me\AppData\Local\Continuum\anaconda3\Lib\site-packages\skimage\util__init__.py", line 1, in from .dtype import (img_as_float32, img_as_float64, img_as_float,
File "C:\Users\me\AppData\Local\Continuum\anaconda3\Lib\site-packages\skimage\util\dtype.py", line 1, in import numpy as np
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy__init__.py", line 142, in from . import core
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\numpy\core__init__.py", line 23, in WinDLL(os.path.abspath(filename))
File "C:\Users\me\AppData\Local\Continuum\anaconda3\lib\ctypes__init__.py", line 356, in init self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 it's not a valid application of Win32
(the last line is translated by me) that I've searched, but despite is a rather well known problem, I cannot find a solution.
Solution
Proposed solution: creating a new (virtual) environment
From the given outputs, I would suggest creating a new environment to encapsulate all packages for your current development.
For help regarding environments together with anaconda you may want to look here or create them within the gui.
Some rational for using virtual environments in general you can find in the documentation. In short: Environments are an easy way to have separated versions of packages for different projects and you separate your development from the system python installation, which may has different packages.
Why virtual environment in your case?
Currently, it looks like a mix of packages from your system installation, paths like
"C:\Users\me\AppData\Local\Programs\Python..."
and installations of anaconda, with paths from
"C:\Users\me\AppData\Local\Continuum\anaconda3\Lib..."
probably this causes your problem (and probably will cause some more).
Answered By - Sparky05
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.