cmbruns / pyopenvr

Unofficial python bindings for Valve's OpenVR virtual reality SDK
BSD 3-Clause "New" or "Revised" License
245 stars 39 forks source link

Could not find module 'libopenvr_api_64'. #72

Closed MrAlexEsisteGia closed 4 years ago

MrAlexEsisteGia commented 4 years ago

Windows 10 Python 3.8.0

I'm using the README.md example

But when i try to run it i get: Traceback (most recent call last): File "C:\Users\ale54\Desktop\pyopenvrstuff\sas.py", line 3, in <module> import openvr File "C:\Users\ale54\AppData\Local\Programs\Python\Python38\lib\site-packages\openvr\__init__.py", line 58, in <module> _openvr = cdll.LoadLibrary(_openvr_lib_name) File "C:\Users\ale54\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 447, in LoadLibrary return self._dlltype(name) File "C:\Users\ale54\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 369, in __init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'libopenvr_api_64'. Try using the full path with constructor syntax.

risa2000 commented 4 years ago

@MrAlexEsisteGia How did you install pyopenvr? Could you try it with Python 3.7.x?

MrAlexEsisteGia commented 4 years ago

Oh going back to 3.7.5 fixed the problem Thanks! Also i installed it with pip3 install openvr

risa2000 commented 4 years ago

Just for the record. I believe the problem is not in pyopenvr per se, but in (probably) breaking change in ctypes.CDLL implementation. I have been hit by similar behavior on another project, which also uses ctypes to interface with the native DLL (https://github.com/randombit/botan), when I was trying to run it in Python 3.9 (dev branch).

MrAlexEsisteGia commented 4 years ago

Disclaimer: Im new(started a few days ago) to python so im probably 95% wrong I think it's the fact that the new CDLL change they deprecated the old method without realizing that they broke it ??

also, are you italian by any chance?

in pyopenvr per se,

risa2000 commented 4 years ago

I think it's the fact that the new CDLL change they deprecated the old method without realizing that they broke it ??

Python 3.8 changed the method the DLLs are loaded in Windows and made it independent on PATH environment variable. The code which needs to load a DLL from "non-standard" place (i.e. its own directory) has to use a different approach to add this directory to the loader search path.

BTW: per se comes from Latin and is also used in other languages (so I am not Italian ;-))

MrAlexEsisteGia commented 4 years ago

Oh, i get it, that makes a lot more sense, thanks for explaning me that!