zhuminjie / OpenSeesPy

OpenSeesPy versions, doc, and pip
Other
177 stars 66 forks source link

Import error for Openseespy 3.7 #143

Closed hoffcon-tom closed 2 months ago

hoffcon-tom commented 2 months ago

After the 3.7 update I am not able to successfully import openseespy into my scripts. I discovered this after making a new virtual environment and trying to load previously working scripts.

I'm running Python 3.11.4 which according to the pip website should work (Requires: Python >=3.8) and was working with the 3.6 release.

I checked the change log (https://openseespydoc.readthedocs.io/en/latest/src/changelog.html) to see if there were any notes about breaking changes, but it only lists versions up to 3.4.0.7.

This is the error I get:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~\.venv\Lib\site-packages\openseespywin\__init__.py:20
     19 try:
---> 20     from openseespywin.opensees import *
     21 except:

ImportError: DLL load failed while importing opensees: The specified module could not be found.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
File ~\.venv\Lib\site-packages\openseespy\opensees\__init__.py:19
     18 try:
---> 19     from openseespywin.opensees import *
     21 except:

File ~\.venv\Lib\site-packages\openseespywin\__init__.py:22
     21     except:
---> 22         raise RuntimeError('Failed to import openseespy on Windows.')
     23 else:

RuntimeError: Failed to import openseespy on Windows.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
Cell In[1], line 6
----> 6 import openseespy.opensees as ops

File ~\.venv\Lib\site-packages\openseespy\opensees\__init__.py:22
     19         from openseespywin.opensees import *
     21     except:
---> 22         raise RuntimeError('Failed to import openseespy on Windows.')
     24 elif sys.platform.startswith('darwin'):
     26     try:

RuntimeError: Failed to import openseespy on Windows.

As a work around, I pined the versions in the requirements.txt as below. (both were required as openseespywin did not downgrade automatically to 3.6 along with openseespy

openseespy==3.6.0.3
openseespywin==3.6.0.3
zhuminjie commented 2 months ago

3.12 is required for Windows, 3.8 for Linux. We will update the requirement to reduce confusion.

hoffcon-tom commented 2 months ago

Thanks for the quick response!