This happens when I try to do:
import scipy.io
Another scipy module, such as scipy.sparse, seems to be OK.
The root error is:
packages/scipy/special/__init__.py", line 636, in <module>
from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
The full stack trace:
Traceback (most recent call last):
File "HistogramClassifier.py", line 3, in <module>
import scipy.io
File "/usr/local/lib/python2.7/site-packages/scipy/io/__init__.py", line 97, in <module>
from .matlab import loadmat, savemat, whosmat, byteordercodes
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/__init__.py", line 13, in <module>
from .mio import loadmat, savemat, whosmat
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/mio.py", line 12, in <module>
from .miobase import get_matfile_version, docfiller
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/miobase.py", line 22, in <module>
from scipy.misc import doccer
File "/usr/local/lib/python2.7/site-packages/scipy/misc/__init__.py", line 51, in <module>
from scipy.special import comb, factorial, factorial2, factorialk
File "/usr/local/lib/python2.7/site-packages/scipy/special/__init__.py", line 636, in <module>
from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
That's pretty much it. Google returns quite a few hits, but they're either very old, or not the same lib, or things that I've tried. The rest of this post is all the stuff I found/tried so far that didn't work.
Double checking python:
which python
/usr/local/bin/python
ls -l /usr/local/bin/python
lrwxr-xr-x ... /usr/local/bin/python -> ../Cellar/python/2.7.13/bin/python
I'm not currently using virtual env.
I think Homebrew is OK:
brew doctor
Your system is ready to brew.
This is after trying this:
brew update
brew upgrade
I've also tried uninstalling and reinstalling the scipy package, both with brew and with pip.
I've tried various other things, but don't want to mess up a working Homebrew setup.
Older posts that Google brought back talk about "cobra", as far as I know I'm not using that. "which cobra" doesn't return anything.
Other things from Google talk about the order of the library path, but that seemed to be if you were using the built-in python, which I don't don't think is applicable since I believe I'm using Homebrew's version.
Clearly it has something to do with a library, maybe fortran related, but what to type in to fix it... don't know where to start.
Try this: remove /usr/lib/libSystem.B.dylib temporarily and then reinstall scipy.
Related
I have a question about using numpy library.
A couple of months ago, I downloaded Anaconda, which gives numpy automatically.
I am trying to use numpy by importing from ANaconda to Python.
WHat I have done is:
I added the package of numpy from Anaconda folder to Python folder.
However, the python shell says that
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Alice Jun\Desktop\Python 3.9\gui.py", line 2, in <module>
import numpy as np
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Users\Alice Jun\Desktop\Python 3.9\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
What should I do to import numpy?
Thank you and stay safe!
As others mentioned, that is not a proper way of installing a package. You are making a copy anyway, so install it through proper routes, e.g.,
# where `python` is the one you wish to use
python -m pip install numpy
Otherwise, the reason why what OP shows did not work is because packages are located under a site-packages directory (search under your Python 3.9/ directory. If one really wants to manually install a package, that's where it goes.
However, be aware that Conda packages make heavy use of dynamic linking in order to minimize redundancy of common dependencies. This is often done through #rpath specifications, which means moving packages out of their Conda environment path will frequently result in non-functionality.
According to the FiPy website, you need "at least one of the solvers", and they list SciPy as one possible "solver". I definitely have SciPy installed - I can import it with import scipy. I haven't formally installed FiPy with setup.py or anything like that, I just have the code in a folder called fipy. When I then go into the Python shell and type import fipy, I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "fipy/__init__.py", line 44, in <module>
from solvers import *
File "fipy/solvers/__init__.py", line 68, in <module>
raise ImportError, "Could not import any solver package. If you are using Trilinos, make sure you have all of the necessary Trilinos packages installed - Epetra, EpetraExt, AztecOO, Amesos, ML, and IFPACK."
ImportError: Could not import any solver package. If you are using Trilinos, make sure you have all of the necessary Trilinos packages installed - Epetra, EpetraExt, AztecOO, Amesos, ML, and IFPACK.
I've already tried doing this after formally installing FiPy via setup.py (using pip didn't work, I got some strange error relating to tensorflow). Setting the FIPY_SOLVERS environment variable didn't work either (same error).
I'm on Ubuntu with Python 2.7.
Based on File "fipy/__init__.py", line 44, in <module> and File "fipy/solvers/__init__.py", line 68, in <module>, you appear to be running FiPy 2.1.x, which is quite old.
Please upgrade.
I got "numpy.dtype has the wrong size, try recompiling" in both pycharm and terminal when compiling Sci-kit learning. I've upgraded all packages(numpy, scikit to the latest), nothing works.Python version is 2.7. Please help. Appreciate!
checking for nltk
Traceback (most recent call last):
File "startup.py", line 6, in <module>
import nltk
File "/Library/Python/2.7/site-packages/nltk/__init__.py", line 128, in <module>
from nltk.chunk import *
File "/Library/Python/2.7/site-packages/nltk/chunk/__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "/Library/Python/2.7/site-packages/nltk/chunk/api.py", line 13, in <module>
from nltk.parse import ParserI
File "/Library/Python/2.7/site-packages/nltk/parse/__init__.py", line 79, in <module>
from nltk.parse.transitionparser import TransitionParser
File "/Library/Python/2.7/site-packages/nltk/parse/transitionparser.py", line 21, in <module>
from sklearn.datasets import load_svmlight_file
File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>
from .utils.fixes import signature
File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>
from .murmurhash import murmurhash3_32
File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling
The error "numpy.dtype has the wrong size, try recompiling" means that sklearn was compiled against a numpy more recent than the numpy version sklearn is now trying to import. To fix this, you need to make sure that sklearn is compiled against the version of numpy that it is now importing, or an earlier version. See ValueError: numpy.dtype has the wrong size, try recompiling for a detailed explanation.
I guess from your paths that you are using the OSX system Python (the one that ships with OSX, at /usr/bin/python). Apple has modified this Python in a way that makes it pick up its own version of numpy rather than any version that you install with pip etc - see https://github.com/MacPython/wiki/wiki/Which-Python#system-python-and-extra-python-packages . I strongly recommend you switch to Python.org or homebrew Python to make it easier to work with packages depending on numpy.
The problem occurs when you are using incompatible versions. Check the versions using:
pip freeze
or, for a specific module
pip freeze | grep Module_Name
I fix my problem by updating all packages:
pip install -U scikit-learn numpy scipy pandas matplotlib
As of Today(30/11/2016). These versions are compatible:
matplotlib==1.5.2
nltk==3.2.1
numpy==1.11.2
pandas==0.19.1
scikit-learn==0.18.1
scipy==0.18.1
textblob==0.11.1
I usually code in Matlab but I found a nice piece of PYTHON code that I would like to use. However having downloaded the package it is proving difficult to run. I'm getting the following error:
Traceback (most recent call last):
File "C:\launch.py", line 29, in <module>
from src.smcsquare import SMCsquare
File "C:\src\smcsquare.py", line 32, in <module>
from scipy.stats import norm
File "C:\Python34\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
from .stats import *
File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 184, in <module>
import scipy.special as special
File "C:\Python34\lib\site-packages\scipy\special\__init__.py", line 586, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
The _ufuncs.pyd is there in the C:\Python34\lib\site-packages\scipy\special\ directory. I tried adding this to my PYTHONPATH but it made no difference. I have also tried so dll fixers but these have not helped.
Has anyone encountered this and did you find a solution?
As other have said, make sure your .whl file matches the version and 32/64bit of the python distribution you're using.
Next, the problem I was having was I forgot to download and install the extra "numpy+mkl" package per the instruction: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
So for me it was numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl, which I downloaded and then:
python -m pip install numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl
I had already installed the regular numpy package via pip, but I just installed this one over it and everything started working and has been fine so far.
I have been attempting to follow a tutorial online and I have followed every single line and for some reason I get the following error:
Traceback (most recent call last):
File "C:/Users/User/Desktop/OpenGLContextTest.py", line 2, in <module>
from OpenGLContext import testingcontext
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\testingcontext.py", line 10, in <module>
from OpenGLContext import plugins, context, contextdefinition
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\context.py", line 32, in <module>
from OpenGLContext import visitor, texturecache,plugins
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\visitor.py", line 3, in <module>
from OpenGLContext.scenegraph import nodepath
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\scenegraph\nodepath.py", line 3, in <module>
from vrml.vrml97 import nodepath, nodetypes
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\vrml97\nodepath.py", line 4, in <module>
from vrml import nodepath
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\nodepath.py", line 3, in <module>
from vrml import node, weaklist
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\node.py", line 6, in <module>
from vrml import field, fieldtypes, weaklist, weakkeydictfix
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\field.py", line 2, in <module>
from pydispatch import dispatcher, robustapply
ImportError: No module named pydispatch
I have attempted searching on google for the chance that this tutorial may be broken or something, but I don't believe it is. I have pydispatch and have attempted to install it using easy_install yet nothing changes. Can someone please help me with this? I know the code is completely correct as after a while I copied and pasted everything to ensure that it wasn't my syntax.
The instructions (apparently incorrectly) say to install pydispatcher. I had the same problem you did until I installed the module PyDispatcher. Confusingly, both exist.
To clarify on #Phil's answer.
I saw:
No module named pydispatch
And so I did:
sudo pip install pydispatch
The install worked, but Scrapy still didn't work because we were supposed to:
sudo pip install pydispatcher
You need to install PyDispatcher separately. Please take a look at the required packages for the tutorial to work along with the installation instructions here:
PyOpenGL Introduction
Check particularly within the section named Package Installation