I am trying to get numpy<1.19.0 and ConfigSpace==0.4.16 to work in a python==3.7 conda environment. The installed version of numpy is 1.18.5.
I am getting the following error:
Traceback (most recent call last):
File "/home/user/.conda/envs/deephyper/bin/deephyper", line 5, in <module>
from deephyper.core.cli import main
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/__init__.py", line 1, in <module>
from deephyper.core.cli.cli import main
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/cli.py", line 9, in <module>
from deephyper.core.cli import hps, nas, balsam_submit
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/hps.py", line 6, in <module>
from deephyper.search.util import load_attr_from
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/search/__init__.py", line 6, in <module>
from deephyper.search.search import Search
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/search/search.py", line 8, in <module>
from deephyper.evaluator.evaluate import Evaluator
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/evaluator/__init__.py", line 5, in <module>
from deephyper.evaluator.evaluate import Encoder
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/evaluator/evaluate.py", line 15, in <module>
import skopt
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/__init__.py", line 45, in <module>
from . import callbacks
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/callbacks.py", line 17, in <module>
from skopt.utils import dump
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/utils.py", line 19, in <module>
from .sampler import Sobol, Lhs, Hammersly, Halton, Grid
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/sampler/__init__.py", line 4, in <module>
from .lhs import Lhs
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/sampler/lhs.py", line 9, in <module>
from ..space import Space, Categorical
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/space/__init__.py", line 5, in <module>
from .space import *
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/space/space.py", line 27, in <module>
import ConfigSpace as CS
File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/ConfigSpace/__init__.py", line 37, in <module>
from ConfigSpace.configuration_space import Configuration, \
File "ConfigSpace/configuration_space.pyx", line 39, in init ConfigSpace.configuration_space
File "ConfigSpace/hyperparameters.pyx", line 1, in init ConfigSpace.hyperparameters
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
I tried suggested solutions suggested in other similar questions such as trying other versions of numpy or removing all numpy installations and reinstalling numpy and ConfigSpace with pip options --no-cache-dir --no-binary, but the error persists.
Are there other potential solutions that I could try?
I got some additional insight into the issue by consulting this GitHub issue page. As it turns out, if the size from the PyObject is smaller than the size from the C header, an upgrade of the package referenced by the error (here numpy) is necessary to resolve the error, and vice versa.
I was able to resolve the issue by upgrading numpy to version 1.20.0, even though the requirement was numpy<1.19.0.
Sharing this in case it helps others: I was trying to get fairseq to work and ran into the same issue of ValueError with binary incompatibility as possible reason and Jake's suggestion of updating numpy to 1.20.0 helped solve the problem even through requirements specifically asked for numpy<1.19.0.
I ran into the same problem: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject and this solution worked for me. Specifically, using Dockerfile to create an image, I install flair==0.8.0.post1, which requires numpy<1.19.0. But after installing flair==0.8.0.post1 I install numpy==1.20.0 and this has avoided the problem. This section of the Dockerfile is:
RUN pip install flair==0.8.0.post1
RUN pip install numpy==1.20.0
Related
I'm new to conda, but I'm sure I have pandas installed in the base environment. I also have selected it as the python interpreter in VSCode. However, when I try to import pandas it throws the following error:
Traceback (most recent call last):
File "/Users/raimundbuehler/Documents/UNIDOCS/Python:Psychopy:RALT/Rando/Randomization.py", line 2, in <module>
import pandas as pd
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
from pandas.util.version import Version
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa:F401
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa:F401
File "/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
ImportError: dlopen(/Users/raimundbuehler/opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/interval.cpython-39-darwin.so, 0x0002): rebase opcodes terminated early at offset 1 of 1800
I'm assuming numpy to be the problem, but updating both numpy and pandas didn't solve it. It may also be because I have Pycharm and pip installed, so it may be messy regarding multiple installations of python and packages... in fact in Pycharm, I can import pandas (using a different interpreter). Any help how to find out if this is indeed the case and how to solve it would be greatly appreciated!
I refer to this issue.
I think the feasible way may still be to unload and reinstall.
I need to install pandas on a LinuxOS. Initially, I used
sudo apt-get install python3-pandas
It looked like the installation was complete but then I switch to Thonny and import pandas and get this
Traceback (most recent call last):
File "<pyshell>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/pandas/_init_.py", line 22, in <module>
from pandas.compat import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/_init_.py", line 15, in <module>
from pandas.compat.numpy import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/numpy/_init_.py", line 7, in <module>
from pandas.util.version import Version
File "/usr/local/lib/python3.7/dist-packages/pandas/util/_init_.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/libs/init_.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject
I have been looking all over the internet and tried doing everything anyone suggested but it persists. I uninstalled and reinstalled it using sudo pip3 install pandas. Pandas right now is v1.3.4. Tried upgrading it, the prompt said "Requirement already satisfied, skipping upgrade". I am facing a similar issue with installation and importation of trackpy library too but let's just focus on pandas for now. Didn't want to go for Conda as that is huge and I have limited space (this is a RPi I'm working with).
New to Python. Trying to understand how to import the pandas module. I imported it through Pycharm, then ran a basic script seen below. I get several errors that I'm not sure how to interpret
import pandas
x = input("Enter your age")
print(x)
I receive this error message.
Traceback (most recent call last):
File "C:/Users/leeb/PycharmProjects/HelloWorld/app.py", line 1, in <module>
import pandas
File "C:\Users\leeb\PycharmProjects\HelloWorld\venv\lib\site-packages\pandas\__init__.py", line 11, in <module>
__import__(dependency)
File "C:\Users\leeb\PycharmProjects\HelloWorld\venv\lib\site-packages\numpy\__init__.py", line 150, in <module>
from . import random
File "C:\Users\leeb\PycharmProjects\HelloWorld\venv\lib\site-packages\numpy\random\__init__.py", line 181, in <module>
from . import _pickle
File "C:\Users\leeb\PycharmProjects\HelloWorld\venv\lib\site-packages\numpy\random\_pickle.py", line 1, in <module>
from .mtrand import RandomState
File "type.pxd", line 9, in init numpy.random.mtrand
ValueError: builtins.type size changed, may indicate binary incompatibility. Expected 440 from C header, got 432 from PyObject
This error tends to happen when you have an older version of Numpy installed.
You should upgrade it, as follows:
pip install numpy --upgrade
If that doesn't work, try to use a specific version of numpy, as follows:
pip uninstall numpy
pip install numpy==1.15.1
Or, if you're using anaconda, try:
conda update numpy
I tried download the package and python setup.py develop. However this directly installs GPflow under anaconda. Plus this isn't really working anaconda and gives error
/Users/Chu/anaconda/bin/python /Users/Chu/Documents/dssg/dssg.py
Traceback (most recent call last):
File "/Users/Chu/Documents/dssg/dssg.py", line 4, in <module>
import GPflow
File "/Users/Chu/Documents/GPflow-master/GPflow/__init__.py", line 18, in <module>
from . import (likelihoods, kernels, ekernels, param, model, gpmc, sgpmc, priors, gpr, svgp, vgp, sgpr, gplvm, tf_wraps,
File "/Users/Chu/Documents/GPflow-master/GPflow/likelihoods.py", line 17, in <module>
from . import densities, transforms
File "/Users/Chu/Documents/GPflow-master/GPflow/transforms.py", line 18, in <module>
from . import tf_wraps as tfw
File "/Users/Chu/Documents/GPflow-master/GPflow/tf_wraps.py", line 36, in <module>
_custom_op_module = tf.load_op_library(os.path.join(os.path.dirname(__file__), 'tfops', 'matpackops.so'))
File "/Users/Chu/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/Chu/Documents/GPflow-master/GPflow/tfops/matpackops.so, 6): image not found
So I think I should try install it under library? Here are some other captures:
I have the same issue even if when I try to install it outside Pycharm. I looked into the reported issue in Github, and the problem was solved for someone else when he built TensorFlow from scratch uisng gcc5
I dont think you can just simply install GPflow on pycharm. Do it outside and then you can use it. Here is the link where it is reported to be solved:
https://github.com/GPflow/GPflow/issues/192
I'm going to preface this by saying that I'm relatively new to Python and so please forgive me if I have difficulty understanding something.
I've recently been trying to install OpenCV on my computer following the "Installing OpenCV from prebuilt binaries" instructions found here:
http://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html#gsc.tab=0
I initially tried to install OpenCV by itself, as I already had Python 3.5 and a working version of numpy. However, my attempts to import cv2 failed, and I eventually decided to uninstall Python and follow all the steps listed on the website. However, I now have this error when I try import numpy:
Traceback (most recent call last):
File "C:/PythonProgramming/SLIC/src/SLICAlgorithm.py", line 1, in <module>
import numpy
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 180, in <module>
from . import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
from type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 20, in <module>
import function_base
File "C:\Python27\lib\site-packages\numpy\core\function_base.py", line 6, in <module>
from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError
ImportError: cannot import name shares_memory
Process finished with exit code 1
Other people online seem to have no problem with these instructions, or at least not with numpy. What does this error mean, and what can I do to fix it? I have a 64-bit version of Windows 10 and am working in PyCharm. All help you can provide would be much appreciated.
same problem, the following fix worked for me
pip install -I numpy --force-reinstall