Reputation: 101
I have been writing code in Python 3 on Windows 10 and need to call a function which was written in Julia, so I have installed Julia and PyJulia. I have encountered a very strange problem, however: while I can import and call Julia modules just fine in Python terminal (though importing them can take an unexpected few seconds), trying to import any Julia module in a Python script will give an error.
I can run a line
import julia
just fine, but something as simple as
from julia import Base
will give the two dialog boxes and error in terminal screenshotted below. My question is simply, does anyone know what is going on here, or how to fix it? Thanks.
from julia import Base
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\ProgramData\Anaconda3\lib\site-packages\julia\core.py", line 248, in load_module
elif self.julia.isafunction(juliapath):
File "C:\ProgramData\Anaconda3\lib\site-packages\julia\core.py", line 239, in julia
self.__class__.julia = julia = Julia()
File "C:\ProgramData\Anaconda3\lib\site-packages\julia\core.py", line 472, in __init__
self.api = LibJulia.from_juliainfo(jlinfo)
File "C:\ProgramData\Anaconda3\lib\site-packages\julia\libjulia.py", line 195, in from_juliainfo
sysimage=juliainfo.sysimage,
File "C:\ProgramData\Anaconda3\lib\site-packages\julia\libjulia.py", line 215, in __init__
self.libjulia = ctypes.PyDLL(libjulia_path, ctypes.RTLD_GLOBAL)
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found
Upvotes: 1
Views: 554
Reputation: 42214
Looks like you forgot to configure Python Julia module.
You should run:
import julia
julia.install()
In this way Python should be able to find paths.
Note also that julia.exe
should be in your system PATH. You can run set PATH
in command line console to see where it is. To test the configuration run in console where julia
(I am showing here my output):
C:\Users\pszufe>where julia
C:\Julia-1.6.0-rc1\bin\julia.exe
Finally, please also have a look here: I have a high-performant function written in Julia, how can I use it from Python?
Upvotes: 1