Closed shernandez43 closed 5 years ago
Hi! Yes it is because orekit and some other conda packages needs the environement to be "activated" in order to get the right environment variables. This is automatically done when opening through the conda prompt. Pycharm and spyder accesses the python binary directly normally without activating the environment.
To solve this, one can either activate the environment prior to starting pycharm or spyder through the command line or use a package called conda-wrappers that makes "pseudo" binaries for the environment that automatically also activates it. These are accessed in the scripts/wrappers/ directory in your python installation after installing the conda-wrappers package.
There are some more info about installation and if you want to specify the paths manually at
https://www.orekit.org/forge/projects/orekit-python-wrapper/wiki
Closing as no further response and very likely the root cause.
Hello Petrus,
I was indeed trying to follow the same guidelines to point Spyder to the wrapper in Scripts/wrappers/conda/python.bat, but a .bat file is not considered an interpreter by Spyder? I am very new to python so I apologize if that sounds weird. Indeed, if I open Spyder from the anaconda prompt, no problems importing orekit. If I open spyder from the command prompt or through shortcut, it gives me this error, even though I only have one env, base, and it is activated. In any case I can keep launching Spyder from conda prompt. Activation of python environments has really bugged me so I would like to get to the bottom of it
Hi @quamobrem
Yes it is the activation of environement thing you are experiening, this needs to be done prior to using orekit. If you launch spyder from the start menu directly this is not done. You can also launch spyder from the anaconda-launcher application, that is activating the environment as well.
Regards
Thank you very much for your help Petrus, cheers!
Actual Behavior
C:\Users\SRHERNA1\AppData\Local\conda\conda\envs\orekit_test\python.exe "C:/Users/SRHERNA1/Documents/0) STM/orekit_test2/hello_world.py" Traceback (most recent call last): File "C:/Users/SRHERNA1/Documents/0) STM/orekit_test2/hello_world.py", line 1, in <module> import orekit File "C:\Users\SRHERNA1\AppData\Local\conda\conda\envs\orekit_test\lib\site-packages\orekit\__init__.py", line 3, in <module> from . import _orekit ImportError: DLL load failed: The specified module could not be found.
Expected Behavior
"Hello World" printed to console. This code works when called in conda prompt, but not in Pycharm or Spyder, they both get the same error.
Steps to Reproduce
`import orekit
print("Hello World")`
Anaconda or Miniconda version:
(orekit_test) C:\Users\SRHERNA1>conda -V conda 4.5.4
Operating System:
Windows 7
conda info
conda list --show-channel-urls