Tim-Salzmann / l4casadi

Use PyTorch Models with CasADi for data-driven optimization or learning-based optimal control. Supports Acados.
MIT License
379 stars 29 forks source link

Issue with importing the l4casadi package #52

Closed 770538074 closed 1 month ago

770538074 commented 1 month ago

Dear Author,

I hope this message finds you well.

I followed your instructions and successfully installed l4casadi. My python version is 3.10 ,visual studio version is 2019,pytroch version is 2.41,cuda version is 11.8 ,windows11.Below is the information confirming the successful installation of l4casadi.

(pytorch) PS D:\onedrive\Documents\pycharm\pythonProject> pip install l4casadi --no-build-isolation Collecting l4casadi Using cached l4casadi-1.4.1.tar.gz (27.2 MB) Preparing metadata (pyproject.toml) ... done Requirement already satisfied: torch in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from l4casadi) (2.2.2) Collecting casadi>=3.6 (from l4casadi) Using cached casadi-3.6.7-cp311-none-win_amd64.whl.metadata (2.2 kB) Requirement already satisfied: jinja2>=3.1 in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from l4casadi) (3.1.3) Requirement already satisfied: numpy in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from casadi>=3.6->l4casadi) (1.24.3) Requirement already satisfied: MarkupSafe>=2.0 in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from jinja2>=3.1->l4casadi) (2.1.3) Requirement already satisfied: filelock in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from torch->l4casadi) (3.13.1) Requirement already satisfied: typing-extensions>=4.8.0 in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from torch->l4casadi) (4.9.0) Requirement already satisfied: sympy in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from torch->l4casadi) (1.12) Requirement already satisfied: networkx in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from torch->l4casadi) (3.1) Collecting fsspec (from torch->l4casadi) Using cached fsspec-2024.9.0-py3-none-any.whl.metadata (11 kB) Requirement already satisfied: mpmath>=0.19 in d:\programfiles\anaconda\envs\pytorch\lib\site-packages (from sympy->torch->l4casadi) (1.3.0) Using cached casadi-3.6.7-cp311-none-win_amd64.whl (44.7 MB) Using cached fsspec-2024.9.0-py3-none-any.whl (179 kB) Building wheels for collected packages: l4casadi Building wheel for l4casadi (pyproject.toml) ... done Created wheel for l4casadi: filename=l4casadi-1.4.1-cp311-cp311-win_amd64.whl size=20690 sha256=0abc72f43b2ed6bcba613a6266ac20b247462663e6604ac5f4ca0c011ff939a8 Stored in directory: c:\users\liumingyao\appdata\local\pip\cache\wheels\5c\01\ef\e963bafae08056fcc5d4a99312097a5974609dad2197461c30 Successfully built l4casadi Installing collected packages: fsspec, casadi, l4casadi Successfully installed casadi-3.6.7 fsspec-2024.9.0 l4casadi-1.4.1

However, when I tried to import l4casadi in PyCharm, I encountered the following error:

Traceback (most recent call last): File "D:\onedrive\Documents\pycharm\pythonProject\CNN_LSTM\hello.py", line 9, in import l4casadi File "D:\programfiles\Anaconda\envs\pytorch\Lib\site-packages\l4casadi__init.py", line 15, in ctypes.CDLL(str(lib_path), mode=ctypes.RTLD_GLOBAL) File "D:\programfiles\Anaconda\envs\pytorch\Lib\ctypes\init.py", line 376, in init__ self._handle = _dlopen(self._name, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: Could not find module 'D:\programfiles\Anaconda\envs\pytorch\Lib\site-packages\l4casadi\lib\libl4casadi.dll' (or one of its dependencies). Try using the full path with constructor syntax.

I couldn't find the lib\libl4casadi.dll folder and its contents in the system.Below here is the folder screenshot.I would greatly appreciate it if you could advise on how to resolve this issue or let me know if there are any steps I might have overlooked. image

Thank you in advance for your assistance and for all your hard work on this project. Looking forward to your guidance.

Tim-Salzmann commented 1 month ago

Hi,

unfortunately Windows is not supported.

Best Tim