Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import pyscipopt into python (ubuntu 18.04 and Mac) #327

Closed
wangshgeo opened this issue Jan 11, 2020 · 19 comments
Closed

Cannot import pyscipopt into python (ubuntu 18.04 and Mac) #327

wangshgeo opened this issue Jan 11, 2020 · 19 comments

Comments

@wangshgeo
Copy link

PySCIPOpt was installed successfully, but I cannot import pyscipopt into python (ubuntu 18.04 and Mac).

@mattmilten
Copy link
Collaborator

Hi there!
You need to give us some more information on the error. Please make sure to follow the installation instructions exactly. Please check that you install PySCIPOpt in the same Python environment that you also use to import the module.

cheers,
Matthias

@avrech
Copy link

avrech commented Jan 12, 2020

I have an issue with the -e option. When I try to install it in editable mode I get this:

(venv) ~/PySCIPOpt (master)$ pip install --install-option='--debug' -e .
/home/avrech/comb_rl/venv/lib/python3.6/site-packages/pip/_internal/commands/install.py:283: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Obtaining file:///home/avrech/PySCIPOpt
Installing collected packages: PySCIPOpt
  Found existing installation: PySCIPOpt 2.2.3
    Uninstalling PySCIPOpt-2.2.3:
      Successfully uninstalled PySCIPOpt-2.2.3
  Running setup.py develop for PySCIPOpt
Successfully installed PySCIPOpt
(venv) ~/PySCIPOpt (master)$ python
Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyscipopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyscipopt'

The site-packages/ dir in this case looks like this:

(venv) ~/PySCIPOpt (master)$ cat ../comb_rl/venv/lib/python3.6/site-packages/PySCIPOpt.egg-link
/home/avrech/PySCIPOpt

However, both pip install --install-option=--debug' . and python setup.py install --debug work for me.
In both cases you can see the pyscipopt source files together with the .so inside the venv:

(venv) ~/PySCIPOpt (master)$ ls ../comb_rl/venv/lib/python3.6/site-packages/PySCIPOpt-2.2.3-py3.6.egg-info/
dependency_links.txt  installed-files.txt  PKG-INFO  SOURCES.txt  top_level.txt
(venv) ~/PySCIPOpt (master)$ ls ../comb_rl/venv/lib/python3.6/site-packages/pyscipopt/
benderscut.pxi                        __init__.py                           __pycache__/
benders.pxi                           lp.pxi                                relax.pxi
branchrule.pxi                        Multidict.py                          scip.cpython-36m-x86_64-linux-gnu.so
...

@mattmilten
Copy link
Collaborator

Sorry, @avrech, how is your comment related to this issue?

@avrech
Copy link

avrech commented Jan 15, 2020

Hi @mattmilten,
I describe in detail a case in which I try to import pyscipopt and get ModuleNotFoundError, despite that I follow the INSTALL.md carefully.
Since @wangshgeo have already opened a 'general' issue concerning with import pyscipopt, I thought it will be better to add my particular case here.
I would be happy to understand what my mistake with the -e flag is, anyway.
Sorry for the mess.

Regars
Avrech

@IngoMeise
Copy link

Hi @mattmilten ,
Unfortunately, i can t import pyscipopt, neither (using MacOS). Pyscipopt was installed succesfully. "import pyscipopt" in python (same python environment) gives the following error:

Traceback (most recent call last):
File "", line 1, in
File "...(path).../env/lib/python3.7/site-packages/pyscipopt/init.py", line 5, in
from pyscipopt.scip import Model
ImportError: dlopen(...(path).../env1/lib/python3.7/site-packages/pyscipopt/scip.cpython-37m-darwin.so, 2): Library not loaded: libscip.6.0.dylib
Referenced from: ...(path).../env/lib/python3.7/site-packages/pyscipopt/scip.cpython-37m-darwin.so
Reason: image not found

I have also tried putting the directory containing libscip.6.0.dylib in the DY_LIBRARY_PATH as mentioned in another thread.

Thanks for help!
Ingo

@mattmilten
Copy link
Collaborator

The name of the environment variable has to be DYLD_LIBRARY_PATH. Please try again whether this fixes the issue. Or try to find out which are the default search locations on macOS for dynamic libraries and move your SCIPOptSuite installation there.

@IngoMeise
Copy link

the DYLD_LIBRARY_PATH change did not solve it. A default search location seems to be /usr/lib. tried to move the folder there but "Operation not permitted":

sudo mv /Users/ingomeise/scipoptsuite/SCIPOptSuite-6.0.2-Darwin /usr/lib/
mv: rename /Users/ingomeise/scipoptsuite/SCIPOptSuite-6.0.2-Darwin to /usr/lib/SCIPOptSuite-6.0.2-Darwin: Operation not permitted

@Ixhel
Copy link

Ixhel commented Aug 6, 2020

Same problem here. Failed to build pyscipopt
DEPRECATION: Could not build wheels for pyscipopt which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at pypa/pip#8368.

@fserra
Copy link
Collaborator

fserra commented Aug 6, 2020

I think there are two different problems in this issue. What is your problem and what did you try to do?

@Ixhel
Copy link

Ixhel commented Aug 6, 2020

I think there are two different problems in this issue. What is your problem and what did you try to do?
::::::::::::::::::::::::::::::::::
Downloaded self extracting archive for mac from scip website
Terminal:
chmod 755 SCIPOptSuite-7.0.1-Darwin.sh
./SCIPOptSuite-7.0.1-Darwin.sh
accept license and follow instructions and a new directory named SCIPOptSuite-7.0.1-Darwin is created
cd SCIPOptSuite-7.0.1-Darwin
export SCIPOPTDIR=$PWD
pip3 install pyscipopt
::::::::::::::::::::::::::::::::::::
Collecting pyscipopt
Using cached PySCIPOpt-3.0.1.tar.gz (615 kB)
Building wheels for collected packages: pyscipopt
Building wheel for pyscipopt (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"'; file='"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-wheel-9bhfzwar
cwd: /private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/
Complete output (95 lines):
Using include path </private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/src>.
Using SCIP library at </private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/lib>.
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/Multidict.py -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/init.py -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/scip.pyx -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/scip.pxd -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/propagator.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/heuristic.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/event.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/lp.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/relax.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/benders.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/conshdlr.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/benderscut.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/nodesel.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/expr.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/branchrule.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/sepa.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/presol.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/pricer.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
running build_ext
building 'pyscipopt.scip' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/src
creating build/temp.macosx-10.15-x86_64-3.8/src/pyscipopt
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/src -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/pyscipopt/scip.c -o build/temp.macosx-10.15-x86_64-3.8/src/pyscipopt/scip.o
In file included from src/pyscipopt/scip.c:29:
In file included from /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/Python.h:138:
In file included from /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/compile.h:5:
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:31:2: error: "Need to include ratlptypes.h before code.h"
#error "Need to include ratlptypes.h before code.h"
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:34:2: error: "Need to include mme.h before code.h"
#error "Need to include mme.h before code.h"
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:42:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_inst(Inst inst, int childs, ...);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:42:35: error: unknown type name 'Inst'
extern CodeNode* code_new_inst(Inst inst, int childs, ...);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:44:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_numb(Numb* numb);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:44:35: error: unknown type name 'Numb'
extern CodeNode* code_new_numb(Numb* numb);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:46:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_strg(const char* strg);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:48:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_name(const char* name);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:50:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_size(int size);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:52:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_varclass(VarClass varclass);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:52:39: error: unknown type name 'VarClass'
extern CodeNode* code_new_varclass(VarClass varclass);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:54:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_contype(ConType contype);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:54:38: error: unknown type name 'ConType'
extern CodeNode* code_new_contype(ConType contype);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:56:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_bits(unsigned int bits);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:58:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_symbol(Symbol* sym);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:58:37: error: unknown type name 'Symbol'
extern CodeNode* code_new_symbol(Symbol* sym);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:60:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_define(Define* def);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:60:37: error: unknown type name 'Define'
extern CodeNode* code_new_define(Define* def);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:62:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_bound(BoundType type);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1


ERROR: Failed building wheel for pyscipopt
Running setup.py clean for pyscipopt
Failed to build pyscipopt
DEPRECATION: Could not build wheels for pyscipopt which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at pypa/pip#8368.
Installing collected packages: pyscipopt
Running setup.py install for pyscipopt ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"'; file='"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-record-juv1900m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyscipopt
cwd: /private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/
Complete output (95 lines):
Using include path </private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/src>.
Using SCIP library at </private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/lib>.
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/Multidict.py -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/init.py -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/scip.pyx -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/scip.pxd -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/propagator.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/heuristic.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/event.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/lp.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/relax.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/benders.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/conshdlr.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/benderscut.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/nodesel.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/expr.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/branchrule.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/sepa.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/presol.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
copying src/pyscipopt/pricer.pxi -> build/lib.macosx-10.15-x86_64-3.8/pyscipopt
running build_ext
building 'pyscipopt.scip' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/src
creating build/temp.macosx-10.15-x86_64-3.8/src/pyscipopt
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/src -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/pyscipopt/scip.c -o build/temp.macosx-10.15-x86_64-3.8/src/pyscipopt/scip.o
In file included from src/pyscipopt/scip.c:29:
In file included from /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/Python.h:138:
In file included from /usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/compile.h:5:
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:31:2: error: "Need to include ratlptypes.h before code.h"
#error "Need to include ratlptypes.h before code.h"
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:34:2: error: "Need to include mme.h before code.h"
#error "Need to include mme.h before code.h"
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:42:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_inst(Inst inst, int childs, ...);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:42:35: error: unknown type name 'Inst'
extern CodeNode* code_new_inst(Inst inst, int childs, ...);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:44:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_numb(Numb* numb);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:44:35: error: unknown type name 'Numb'
extern CodeNode* code_new_numb(Numb* numb);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:46:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_strg(const char* strg);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:48:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_name(const char* name);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:50:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_size(int size);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:52:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_varclass(VarClass varclass);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:52:39: error: unknown type name 'VarClass'
extern CodeNode* code_new_varclass(VarClass varclass);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:54:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_contype(ConType contype);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:54:38: error: unknown type name 'ConType'
extern CodeNode* code_new_contype(ConType contype);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:56:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_bits(unsigned int bits);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:58:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_symbol(Symbol* sym);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:58:37: error: unknown type name 'Symbol'
extern CodeNode* code_new_symbol(Symbol* sym);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:60:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_define(Define* def);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:60:37: error: unknown type name 'Define'
extern CodeNode* code_new_define(Define* def);
^
/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/code.h:62:8: error: unknown type name 'CodeNode'
extern CodeNode* code_new_bound(BoundType type);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"'; file='"'"'/private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-install-i78upjpr/pyscipopt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/wg/h055zwvx6td7wyf6y3sk8m_80000gn/T/pip-record-juv1900m/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyscipopt Check the logs for full command output.

@fserra
Copy link
Collaborator

fserra commented Aug 11, 2020

@mattmilten do you have any idea? I find it weird to see stuff like

#error "Need to include ratlptypes.h before code.h"
#error "Need to include mme.h before code.h"

as those are zimpl header files...

@mattmilten
Copy link
Collaborator

I would suggest to compile and install the SCIPOptSuite yourself. The error does look rather strange, though.

@mlangiu
Copy link

mlangiu commented Feb 5, 2021

Hi everyone,

newer versions of macOS protect certain environment variables (such as DYLD_LIBRARY_PATH) from certain processes, also see here.
This is part of System Integrity Protection (SIP) which can be turned off, however this is not recommended.
If it is SIP is left on it is expected that setting DYLD_LIBRARY_PATH to $SCIPOPTDIR/lib will NOT work.

The recommendation to my understanding is to set the required variables from within the process (although this is somewhat cumbersome), so for pyscipopt this could be:

import os
libdir = os.environ['SCIPOPTDIR'] + '/lib'
assert 'libscip.7.0.dylib' in os.listdir(libdir)
os.environ['DYLD_LIBRARY_PATH'] = libdir

However, even after this, we get:

import pyscipopt   # Import Error ... Reason: image not found

Similarly, setting PYTHONPATH (which is forwarded, unlike DYLD_LIBRARY_PATH) as well as inserting into sys.path manually (which should have the same effect) fails:

import sys
...
sys.path.insert(0, libdir)
import pyscipopt   # Import Error ... Reason: image not found

The only thing that worked for me was to create a symbolic link to the required library (in my case libscip.7.0.dylib) to a place that is looked at by python, e.g., /usr/local/lib, e.g:

ln -s $SCIPOPTDIR/lib/libscip.7.0.dylib /usr/local/lib/

I used the precompiled binaries and tried this on macOS 10.15.7
Possibly the same helps for ubuntu.

@loongmxbt
Copy link

Same problem, add following solves the problem.

export SCIPOPTDIR=/Users/username/opt/SCIPOptSuite-7.0.2-Darwin
export DYLD_LIBRARY_PATH=$SCIPOPTDIR/lib

Mac 10.15.3
csrutil status
System Integrity Protection status: enabled.

@tingllllll
Copy link

PySCIPOpt was installed successfully, but I cannot import pyscipopt into python (ubuntu 18.04 and Mac)

@tingllllll
Copy link

PySCIPOpt was installed successfully, but I cannot import pyscipopt into python (ubuntu 18.04 and Mac)
/root/miniconda3/envs/l2sn/lib/python3.9/site-packages/pyscipopt/scip.cpython-39-x86_64-linux-gnu.so: undefined symbol: SCIPexprCreatePolynomial

@Joao-Dionisio
Copy link
Collaborator

Hello, @tingllllll ! How did you install pyscipopt? I would definitely suggest using conda to install it.

@tingllllll
Copy link

Hello, @tingllllll ! How did you install pyscipopt? I would definitely suggest using conda to install it.

I installed it using pip, versions 3.0.2 and 3.1.5 PySCIPOpt was installed successfully, but I cannot import pyscipopt into python

@Joao-Dionisio
Copy link
Collaborator

@tingllllll, do you have any other Python versions? Maybe you are trying to import pyscipopt from a different Python (other than the one with pyscipopt installed)?

Did you follow the instruction here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests