Closed DiegoBArruda closed 9 months ago
@DiegoBArruda could you verify that "libcspice.dll" is located in C:\Users\dwarr\Desktop\diego\lib\site-packages\spiceypy\utils\
? It should be in that directory and about 2.6 MB in size. It would also be helpful for me if you edited line 55 of libspicehelper.py to print the libspice_path variable and report the value. If the file is in that directory and with the expected size then there is some sort of issue either with the path being provided or the actual dll file being produced by cibuildwheel. If the file is not there, then uninstall spiceypy and reinstall it from the wheel first to ensure that your environment correctly reflects that install step. I should also mention that Python 3.7 is no longer supported by spiceypy, although I don't suspect that's the issue here you could also try updating to Python 3.9 or newer.
@DiegoBArruda have you had a chance to run those commands? I have since tried to replicate your issue with python 3.12 installed from python.org and I could not.
closing this issue due to inactivity
@AndrewAnnex, I'll jump in here since I'm having the same issue.
The error I get (matches Diego's):
c:\Users\a_user\AppData\Local\anaconda3\Lib\site-packages\pyproj__init__.py:89: UserWarning: pyproj unable to set database path.
_pyproj_global_context_initialize()
Traceback (most recent call last):
File "c:\A_python_script.py", line 13, in
Desktop Setup:
To answer the question directed at Diego, I do not see a .DLL or .SO in C:\Users\a_user\AppData\Local\anaconda3\Lib\site-packages\spiceypy\utils\
:
First time trying to use SpiceyPy (and conda for that matter). I installed it with the steps for conda listed here: https://spiceypy.readthedocs.io/en/main/installation.html
@tomcat327 could you run conda list
for the conda environment? For conda the shared library for spiceypy should not be in the site-packages folder at all because cspice is separately installed (see https://github.com/conda-forge/spiceypy-feedstock). In the output for conda list
you should see cspice
also from the conda forge.
@DiegoBArruda installed spiceypy through Pip which would include that file anyways so I think you are having a different issue.
@AndrewAnnex, yes, looks like I have cspice in my conda list
:
cspice 67 hcfcfb64_6 conda-forge
That gave me a good hint. I was able to find two cspice
folders, one of which matches the conda list
result:
C:\Users\a_user\AppData\Local\anaconda3\pkgs\cspice-67-h8ffe710_2\
C:\Users\a_user\AppData\Local\anaconda3\pkgs\cspice-67-hcfcfb64_6\
In both, I found cspice.dll in subfolders .\Library\lib
and .\Library\bin
.
First thing I noticed is that these are cspice.dll
instead of libcspice.dll
. Any ideas what may be going on?
Do I just need to create the environmental variable CSPICE_SHARED_LIB
or LD_LIBRARY_PATH
?
@tomcat327 no you shouldn't have to set either of those environment variables for this to work (those are for more specialized users), as I recall https://docs.python.org/3/library/ctypes.html#ctypes.util.find_library on line 41 should locate cspice.dll. You can try either renaming the dll to libcspice.dll or updating line 53 in libspicehelper.py also, but these lines of code haven't changed for 2-3 years and neither has the cspice feedstock, though so maybe something else with your PATH variable that's different than expected.
@AndrewAnnex, thank you again for the hints. I've just made the discovery that find_library("cspice")
works in python when ran from the terminal (or command line), but not from the debugger in my VS Code setup. I am sure there is something about my VS Code setup that is causing the problem, but either way I am able to run via command line so this will work. Thank you very much, and if for some reason I discover what is wrong with my VS code setup, I'll update here.
oh that may explain @DiegoBArruda issue, I don't use VS code that often and don't work in windows almost ever so this is likely something weird and particular to VS code. You could use the CSPICE_SHARED_LIB
environment variable though within vs code I'm sure to mitigate the issue
Hello @AndrewAnnex
Unfortunately I can't check it for you because I followed the simple path of updating the project to py .12. Fortunately, with conda, everything was resolved instantly.
But yes, I used VScode on a Windows OS.
Sorry for disappearing. Add final exams and an internship at an aircraft factory in another state, and we have the cake called delayed projects
(diego) C:\Users\dwarr\Desktop\SpiceyPy>"c:/Users/dwarr/Desktop/diego/Scripts/python.exe" "c:/Users/dwarr/Desktop/Nova pasta (2)/diego/teste.py" Traceback (most recent call last): File "c:/Users/dwarr/Desktop/diego/teste.py", line 1, in
import spiceypy
File "c:\Users\dwarr\Desktop\diego\lib\site-packages\spiceypy__init__.py", line 27, in
from .spiceypy import *
File "c:\Users\dwarr\Desktop\diego\lib\site-packages\spiceypy\spiceypy.py", line 36, in
from .utils.libspicehelper import libspice
File "c:\Users\dwarr\Desktop\diego\lib\site-packages\spiceypy\utils\libspicehelper.py", line 56, in
libspice = CDLL(libspice_path)
File "C:\Users\dwarr\AppData\Local\Programs\Python\Python37-32\lib\ctypes__init.py", line 364, in init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Não foi possível encontrar o módulo especificado
I installed spiceypy both through pip and the github file, in environments suitable for testing (empty environments) and in my development environment for the big project. All the same error.
I've already tried the --no-cache-dir option, no results, the same error appears.
Could you help me with this?
Desktop Setup