pyjulia icon indicating copy to clipboard operation
pyjulia copied to clipboard

PyJulia build fails; can't find package 'Pkg' in current path

Open Will-Gorman opened this issue 5 years ago • 1 comments

I am trying to build PyJulia on my system but get the following error when trying to install via Python:

>>> import julia
>>> julia.install()
ERROR: LoadError: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

Stacktrace:
 [1] require(::Module, ::Symbol) at .\loading.jl:823
 [2] include at .\boot.jl:326 [inlined]
 [3] include_relative(::Module, ::String) at .\loading.jl:1038
 [4] include(::Module, ::String) at .\sysimg.jl:29
 [5] exec_options(::Base.JLOptions) at .\client.jl:267
 [6] _start() at .\client.jl:436
in expression starting at C:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\install.jl:12
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\tools.py", line 102, in install
    raise PyCallInstallError("Installing", output)
julia.tools.PyCallInstallError: Installing PyCall failed.

When I install via Julia, I make sure to point the build installation to the correct Python interpreter and libpython, however, when I try to make a simple call within Python it says that those variables haven't been defined.

>>> import julia
>>> from julia import Main
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\core.py", line 246, in load_module
    JuliaMainModule(self, fullname))
  File "C:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\core.py", line 148, in __init__
    self._julia = loader.julia
  File "C:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\core.py", line 238, in julia
    self.__class__.julia = julia = Julia()
  File "C:\Users\wgorman\AppData\Local\Continuum\anaconda3\lib\site-packages\julia\core.py", line 482, in __init__
    raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.

Julia executable:
    julia
Python interpreter and libpython used by PyCall.jl:
    None
    None
Python interpreter used to import PyJulia and its libpython.
    C:\Users\wgorman\AppData\Local\Continuum\anaconda3\python.exe
    C:\Users\wgorman\AppData\Local\Continuum\anaconda3\python37.dll
julia> versioninfo()
Julia Version 1.0.5
Commit 3af96bcefc (2019-09-09 19:06 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
Windows-10-10.0.18362-SP0
8 logical CPU cores, Intel64 Family 6 Model 42 Stepping 7, GenuineIntel

Will-Gorman avatar May 14 '20 01:05 Will-Gorman

Solution answered on stackoverflow feels like a workaround rather than a solution that connects julia and python.

https://stackoverflow.com/questions/61787575/pyjulia-build-fails-cant-find-package-pkg-in-current-path-during-import

Will-Gorman avatar May 15 '20 16:05 Will-Gorman