Search code examples
pythonpython-3.xmodulepipmathematical-optimization

Failure with importing pyscipopt


I'm trying to import pyscipopt, but this error is shown. Could be here an error of the path?

import pyscipopt Traceback (most recent call last): File "", line 1, in File "C:\Users\amorc\AppData\Roaming\Python\Python39\site-packages\pyscipopt_init_.py", line 6, in os.add_dll_directory(os.path.join(os.getenv('SCIPOPTDIR').strip('"'), 'bin')) AttributeError: 'NoneType' object has no attribute 'strip'

Thanks in advance Amor


Solution

  • os.getenv('SCIPOPTDIR').strip('"')
    

    returns the error. That means the .getenv() returns None. Your environment has not set variable of SCIPOPTDIR.

    Opening new console or restarting machine might help because on Windows sometimes you need that to use new environment variables. You can also look here PySCIPOpt install docs. They ask you to set this variable yourself if the module is not installed in the global path.