ds4dm / ecole

Extensible Combinatorial Optimization Learning Environments
https://www.ecole.ai
BSD 3-Clause "New" or "Revised" License
319 stars 68 forks source link

Import error: Numpy is 0xd while API version compiled is 0xe #271

Closed samiit closed 2 years ago

samiit commented 2 years ago

Describe the bug

When I tried to install on Ubuntu 20 using Conda and when calling it within Python shell, I get an import error.

Setting

To Reproduce

Installed using

conda install -c conda-forge ecole

Followed by executing in a python shell:

import ecole

gives the following error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-4039d98168f3> in <module>
----> 1 import ecole

~/anaconda3/envs/waterDN2/lib/python3.8/site-packages/ecole/__init__.py in <module>
      1 import sys
      2 
----> 3 from ecole.core import RandomEngine, seed, spawn_random_engine, Exception
      4 
      5 import ecole.version

ImportError: SystemError: <built-in method __contains__ of dict object at 0x7f8f6ae5fac0> returned a result with an error set

Expected behavior

It should have imported successfully.

Additional context

AntoinePrv commented 2 years ago

I believe your conda environment is corrupted. Can you try again making a fresh one:

conda create -c conda-forge -n env_name ecole

Or from an environment file

conda env create --file environment.yml
samiit commented 2 years ago

Hi Antoine,

I tried your something along your suggestion and it worked.

I am afraid that something was wrong with my environment.

Regards, Sam