Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLL Load Fail, not working on Conda, Python 3.8, 3.10, 3.11 #3497

Closed
BullAJ opened this issue Jun 25, 2023 · 10 comments
Closed

DLL Load Fail, not working on Conda, Python 3.8, 3.10, 3.11 #3497

BullAJ opened this issue Jun 25, 2023 · 10 comments

Comments

@BullAJ
Copy link

BullAJ commented Jun 25, 2023

image

I get this error after following the instructions to install OpenSim 4.4 for python, here

I have also viewed similar issues that have since been resolved, but none of them were able to help me. Some were not relevant, and others I got a different outcome. I have tried with conda using the provided environment with Python 3.8, the base conda environment with Python 3.10, and without a conda environment on Python 3.11. The same error occurs each time.

Perhaps there is something I am missing when installing? Is this a case where I should try uninstalling Osim altogether? What version of Python is Opensim 4.4 meant for?

Thank you in advance!

@aymanhab
Copy link
Member

The instructions you followed can only work for python version 3.8 since that's the version of python that the application is built against, if you intend to use OpenSim in any other setting. I strongly recommend you use the conda package as it is self contained. Python 3.8 changed how path is handled, so to avoid the changes to the PATH, PYTHONPATH and all the variations that can and will change the behavior between python 3.7, 3.8, and later versions, please use Conda. If that resolves your problem please close this issue, otherwise describe the behavior in conda environment WITHOUT setting either Path or Pythonpath to any other OpenSim installation.

@nickbianco
Copy link
Member

nickbianco commented Jun 26, 2023

Hi @BullAJ, this is a known issue (#3450, for your reference @aymanhab).

As a temporary workaround, you can call the following code at the top of any Python scripts you want to run:

import os
os.add_dll_directory('/path/to/bin')

Where '/path/to/bin' is the directory of the bin folder in your OpenSim install.

@aymanhab
Copy link
Member

Thanks @nickbianco but the issue you pointed to was specific to having a local build so I'm not sure it applies here. Would be good to sort that out so we can either fix documentation or the package if needed.

@nickbianco
Copy link
Member

@aymanhab, the issue will occur why you try to manually install any OpenSim install into a conda environment, whether it's from a local build or downloaded from SimTK.org. If a conda environment is detected, the DLL_PATH set by setup_win_python38.py gets ignored:

if (sys.version_info.major == 3 and sys.version_info.minor >= 8 and sys.platform.startswith('win')):

This works fine for the conda package builds of OpenSim, but breaks any manual local installs.

@aymanhab
Copy link
Member

@nickbianco The branch used to build conda packages does not have this line as it knows its target environment

if sys.version_info.major == 3 and sys.version_info.minor >= 8 and sys.platform.startswith('win'):

So, indeed a local install from master or from a prebuilt application will exhibit the issue but a proper direct conda install from anaconda.org will not. Appreciate if you can confirm @BullAJ

@BullAJ
Copy link
Author

BullAJ commented Jun 27, 2023

Please excuse me as I am not as familiar with Conda, but looking back on your replies and the documentation made me realize I was previously only doing manual install. Do please correct my understanding if my explanation below is wrong.

I did manage to get Python 3.8 via manual install (python setup_win_python38.py; python -m pip install .) with the provided conda_env.yml to work by removing OpenSim from PATH and PYTHONPATH, then using os.add_dll_directory('path/to/bin').

I am attempting the conda install with Python 3.10 now.

@BullAJ
Copy link
Author

BullAJ commented Jun 27, 2023

To clarify, the manual install was with downloaded binaries from simtk.org.

Also, can confirm conda package install does not work for me in the conda base environment, for whatever reason. I get the same behavior as in the original post.

Would I need to uninstall somehow in order to get the conda package to work? I would prefer the conda package if possible

@aymanhab
Copy link
Member

@BullAJ the title of the issue mentioned Conda so I assumed that it was your goal environment. As such my suggestion was to remove changes made to path, pythonpath and install using the one line install as described here
https://anaconda.org/opensim-org/opensim
we do not provide a conda_env.yml so not sure where you got yours.

The page above has windows builds up to python 3.9 so you should test with python 3.9, I'm uploading 3.10 and 3.11 builds shortly. My worry about your environment is that it has been polluted with many attempts at installation in the base environment that it's hard to start clean to assess. I'd remove all opensim packages from your base environment before you start.

@aymanhab
Copy link
Member

Packages for 310, 311 on windows are there now. I look forward to hear how it goes.

@BullAJ
Copy link
Author

BullAJ commented Jun 29, 2023

Conda package installed just fine on Python 3.10. I won't bother with 3.11 as Conda does not build for that yet, that I have seen.

Marking as closed. Thank you for the help!

@BullAJ BullAJ closed this as completed Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants