I am trying to install a python module called tables, which depends on HDF5. I have installed HDF5 using pkgsrc, so the libraries and headers are in /usr/pkg/lib and /usr/pkg/include, respectively. This is on a Mac (OS 10.9.4).
I am able to install the tables module using pip only if I first export HDF5_DIR=/usr/pkg. That's not a problem in and of itself, but after pip says it has successfully installed tables, I still can't import the module and the error message seems to indicate that it can't find a library related to HDF5. Please see the error message below. I'm guessing that the hint in the error is 2): Symbol not found: _H5E_CALLBACK_g
In [1]: import tables
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-389ecae14f10> in <module>()
----> 1 import tables
/Users/gregory/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/tables/__init__.py in <module>()
80
81 # Necessary imports to get versions stored on the cython extension
---> 82 from tables.utilsextension import (
83 get_pytables_version, get_hdf5_version, blosc_compressor_list,
84 blosc_compcode_to_compname_ as blosc_compcode_to_compname,
ImportError: dlopen(/Users/gregory/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/tables/utilsextension.so, 2): Symbol not found: _H5E_CALLBACK_g
Referenced from: /Users/gregory/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/tables/utilsextension.so
Expected in: flat namespace
in /Users/gregory/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/tables/utilsextension.so
Related
I am trying to import an API key from a python file and I get this error:
ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_27940\425884591.py in
9
10 # Import the OpenWeatherMap's API key
---> 11 from config import weather_api_key
ImportError: cannot import name 'weather_api_key' from 'config' (C:\Users\mjrm_\anaconda3\envs\PythonData\lib\site-packages\config_init_.py)
I have done many fixes that I found but I keep getting this error.
I tried changing the py file name and also attempted verifiy loading different packages into my environment, I feel like the error fix is simple but I cannot figure this out
I'm trying to import modules ending in cpython-39-darwin.so and python doesn't recognize them. When I remove cpython-39-darwin and just leave .so, my program can recognize them, but then it raises an error about 'incompatible architecture'. I noticed this issue when trying to import open3d, but it's happening with other libraries too.
I have a new MacBook (M1 Pro) and I'm wondering if this has anything to do with the issue.
import open3d
ModuleNotFoundError Traceback (most recent call last)
Input In [26], in <cell line: 1>()
----> 1 import open3d
File ~/opt/anaconda3/lib/python3.9/site-packages/open3d/init.py:90, in <module>
84 warnings.warn(
85 "Open3D was built with CUDA support, but Open3D CUDA Python "
86 "binding library not found! Falling back to the CPU Python "
87 "binding library.", ImportWarning)
89 ifDEVICE_API == 'cpu':
---> 90 from open3d.cpu.pybind import (camera, data, geometry, io, pipelines,
91 utility, t)
92 from open3d.cpu import pybind
94 import open3d.core
ModuleNotFoundError: No module named 'open3d.cpu.pybind'
The file itself is in /open3d/cpu/pybind.cpython-39-darwin.so. When I change it to /open3d/cpu/pybind.so, it recognizes the file, but now I get the following error:
ImportError
...
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/pybind.so' (no such file), '/usr/lib/pybind.so' (no such file)
I have Anaconda3. When I use its interpreter from Pycharm or directly from the folder to import numpy I get the following error:
ImportError Traceback (most recent call last)
~\Anaconda\lib\site-packages\numpy\core\__init__.py in <module>
16 try:
---> 17 from . import multiarray
18 except ImportError as exc:
~\Anaconda\lib\site-packages\numpy\core\multiarray.py in <module>
13
---> 14 from . import overrides
15 from . import _multiarray_umath
~\Anaconda\lib\site-packages\numpy\core\overrides.py in <module>
6
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-d4cdadb62aa7> in <module>
----> 1 import numpy
~\Anaconda\lib\site-packages\numpy\__init__.py in <module>
140 from . import _distributor_init
141
--> 142 from . import core
143 from .core import *
144 from . import compat
~\Anaconda\lib\site-packages\numpy\core\__init__.py in <module>
45 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
46 __version__, exc)
---> 47 raise ImportError(msg)
48 finally:
49 for envkey in env_added:
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\noamw\Anaconda\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.17.4" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
However, when I use it from ipython after activating my environment, using conda, it works just fine. It's really frustrating that I can't create a Pycharm project like this.
Would really appreciate any help
Thanks
Setting your environment as the interpreter for PyCharm should work. Got to Preferences --> Project --> Project Interpreter. In the drop down menu select your conda environment. Set it to something like: ~/Anaconda3/envs/myenvname/bin/python
It is a bummer that Pycharm has not looked into this issue and has not come up with a solution for it.
Most solutions I found suggest removing numpy and reinstalling it using pip install numpy, which basically defeats the purpose of having a conda environment and getting its benefits like conda revisions; not to mention the bad practice of using both pip and conda in the same environment.
Until Pycharm gets to the bottom of this, you can get around this issue following this:
Activate your environment in command prompt.
Use set command to print all environment variables.
Copy the PATH environment variable.
Add it to the environment variables of your Run/Debug configurations.
While trying to import scipy, I'm getting the following error :
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-4dc45f4c0083> in <module>()
----> 1 import scipy
C:\Users\admin\Anaconda2\lib\site-packages\scipy\__init__.py in <module>()
74
75 # Allow distributors to run custom init code
---> 76 from . import _distributor_init
77
78 __all__ += _num.__all__
ImportError: cannot import name _distributor_init
I have tried re-installing from pip by force reinstall, it says that scipy is up-to-date but then, loading it gives the above error. How do I resolve it? I'm using Python 2.x version.
I was getting the same error while using cx_freeze, i managed to make it work by simply commenting this line in the init.py of scipy (---> 76 from . import _distributor_init).
From what i read there: [Numpy-discussion] Hook in init.py to let distributors patch numpy
it simply enables more customization of checks, that i didn't need.
Scipy seems to work just fine without it.
Fyi I installed scipy without using anaconda, and i use python 3.6.
Hope this helps.
I use cx_Freeze and package have this error. I add this code to solve this problem:
self.build_exe_options = {
'includes': "scipy._distributor_init"
}
just upgrade your sklearn, upgrade everything and u will be fine
I am trying to use the google bigquery python library but whenever I run import bq I get the following error;
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-21-923a4eec0450> in <module>()
----> 1 import bq
/Users/tahirfayyaz/anaconda/python.app/Contents/lib/python2.7/site-packages/bq.py in <module>()
31 import oauth2client.tools
32
---> 33 from google.apputils import app
34 from google.apputils import appcommands
35 import gflags as flags
ImportError: No module named google.apputils
I have installed and even upgraded google-apputils but I still get this error.
The way Google Cloud tools are distributed has changed a bit, you'll be able to download a current version of the software via the Cloud SDK:
* https://developers.google.com/cloud/sdk/
The SDK will install a hermetic environment that contains bigquery as well as all of it's dependencies, like oauth2client and google.apputils. It doesn't use ez-install anymore.
You can add the SDK to your PATH to pick up the current bq.py program.
export PATH=$SDKROOT/platform/bigquery:$PATH
You can add the SDK to your PYTHONPATH if you're trying to import something directly as in your example above.
export PYTHONPATH=$SDKROOT/platform/bigquery:$PYTHONPATH