lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
944 stars 385 forks source link

LCM 1.5.0 on Windows #456

Open psi-jmonaco opened 1 year ago

psi-jmonaco commented 1 year ago

LCM installs effortless under Linux. I was previously able to build LCM 1.4.0 under Windows using MSVC.

I now need a Windows build of LCM 1.5.0 with Python support under Anaconda and am following the recommendations to use MSYS2.

I can seemingly build everything fine using MSYS2 MINGW64 using either unix makefiles or ninja.

However, when I attempt to import lcm, the error below results. I have tried various ways to have the generated DLLs available, e.g. using os.add_dll_directory(...) within python, without success.

Any help is appreciated.


Python 3.10.9 | packaged by Anaconda, Inc. | (main, Mar 1 2023, 18:18:15) [MSC v.1916 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information.

IPython 8.10.0 -- An enhanced Interactive Python.

import lcm Traceback (most recent call last):

Cell In[1], line 1 import lcm

File ~\anaconda3\envs\lcm\lib\site-packages\lcm__init__.py:3 from lcm import _lcm

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

ihilt commented 1 year ago

I don't currently have the option of diving into this issue in an MSYS2 environment. However, it is interesting to me that it cannot find the Python module. The LCM Python module filename should be _lcm.so and it should be on PYTHONPATH. Is that file on your system somewhere? If so, try adding its path to PYTHONPATH (if it's not already) and try import lcm again. If it's not getting built at all, that's obviously a separate issue.

nosracd commented 9 months ago

I tried to reproduce the issue on a Windows VM with MSYS2 MINGW64 but was unable to do so, unfortunately. You mentioned that everything built alright but have did you install before trying to import the Python module? Also make sure that you use the --prefix /mingw64/ when doing so. I also see that you're using Anaconda, which isn't something that's tested on CI. Could you try instead using a different version of Python? (I test locally with pacman's mingw-w64-x86_64-python package, for example).