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

Can't manage to use juliacall in WSL #116

Closed
gpucce opened this issue Feb 20, 2022 · 5 comments
Closed

Can't manage to use juliacall in WSL #116

gpucce opened this issue Feb 20, 2022 · 5 comments

Comments

@gpucce
Copy link

gpucce commented Feb 20, 2022

In WSL 2 I create a conda env, then run

pip install juliacall

this goes fine but then running

from juliacall import Main as jl

throws

[juliapkg] Locating Julia ^1.6
[juliapkg] Querying Julia versions from [https://julialang-s3.julialang.org/bin/versions.json]()
[juliapkg] Using Julia 1.7.2 at /home/gpuccetti/anaconda3/envs/juliacall/julia_env/install/bin/julia
[juliapkg] Using Julia project at /home/gpuccetti/anaconda3/envs/juliacall/julia_env
[juliapkg] Installing packages:
           julia> import Pkg
           julia> Pkg.add([Pkg.PackageSpec(name="PythonCall", uuid="6099a3de-0909-46bc-b1f4-468b9a2dfc0d")])
           julia> Pkg.resolve()
  Activating project at `[~/Repos/juliacall]()`
    Updating registry at `[~/.julia/registries/General.toml]()`
   Resolving package versions...
  No Changes to `[~/Repos/juliacall/Project.toml]()`
  No Changes to `[~/Repos/juliacall/Manifest.toml]()`
  No Changes to `[~/Repos/juliacall/Project.toml]()`
  No Changes to `[~/Repos/juliacall/Manifest.toml]()`
ERROR: ArgumentError: Package PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
 [1] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1089
[2] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [3] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [4] top-level scope
   @ none:5

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
/home/gpuccetti/Repos/juliacall/test_juliacall.ipynb Cell 2' in <module>
----> [1](vscode-notebook-cell://wsl%2Bdebian/home/gpuccetti/Repos/juliacall/test_juliacall.ipynb#ch0000001vscode-remote?line=0) import juliacall

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
/home/gpuccetti/Repos/juliacall/test_juliacall.ipynb Cell 2' in <module>
----> [1](vscode-notebook-cell://wsl%2Bdebian/home/gpuccetti/Repos/juliacall/test_juliacall.ipynb#ch0000001vscode-remote?line=0) import juliacall

File ~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py:137, in <module>
    [133](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=132)         os.chdir(d)
    [135](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=134)     CONFIG['inited'] = True
--> [137](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=136) init()

File ~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py:131, in init()
    [129](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=128)     res = lib.jl_eval_string(script.encode('utf8'))
    [130](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=129)     if res is None:
--> [131](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=130)         raise Exception('PythonCall.jl did not start properly')
    [132](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=131) finally:
    [133](file:///~/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/__init__.py?line=132)     os.chdir(d)

Exception: PythonCall.jl did not start properly
@cjdoris
Copy link
Collaborator

cjdoris commented Feb 21, 2022

I'm confused by this! It says it's using a project at /home/gpuccetti/anaconda3/envs/juliacall/julia_env but then in the following output it looks like it's using a project at ~/Repos/juliacall. The only thing I can think of is that you have JULIA_PROJECT set, though this shouldn't override the command line. What's the output of env | grep JULIA?

@gpucce
Copy link
Author

gpucce commented Feb 21, 2022

So yesterday I was played with it a bit, I could have sent the wrong error message.
Now I am going like this:

$ conda create -n juliacall
$ conda activate juliacall
$ pip install juliacall
$ python
>>> import juliacall

The output is:
import juliacall
[juliapkg] Locating Julia ^1.7.1
[juliapkg] Querying Julia versions from https://julialang-s3.julialang.org/bin/versions.json
[juliapkg] Using Julia 1.7.1 at /home/gpuccetti/.local/bin/julia
[juliapkg] Using Julia project at /home/gpuccetti/anaconda3/envs/juliacall/julia_env
[juliapkg] Installing packages:
julia> import Pkg
julia> Pkg.add([Pkg.PackageSpec(name="PythonCall", uuid="6099a3de-0909-46bc-b1f4-468b9a2dfc0d")])
julia> Pkg.resolve()
Activating project at ~/Repos/juliacall
Updating registry at ~/.julia/registries/General.toml
Resolving package versions...
No Changes to ~/Repos/juliacall/Project.toml
No Changes to ~/Repos/juliacall/Manifest.toml
No Changes to ~/Repos/juliacall/Project.toml
No Changes to ~/Repos/juliacall/Manifest.toml
ERROR: ArgumentError: Package PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.

Stacktrace:
[1] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1089
[2] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[3] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[4] top-level scope
@ none:5Traceback (most recent call last):
File "", line 1, in
File "/home/gpuccetti/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/init.py", line 137, in
init()
File "/home/gpuccetti/anaconda3/envs/juliacall/lib/python3.8/site-packages/juliacall/init.py", line 131, in init
raise Exception('PythonCall.jl did not start properly')
Exception: PythonCall.jl did not start properly

If I run env | grep JULIA nothing shows up

@gpucce
Copy link
Author

gpucce commented Feb 21, 2022

I hope this helps you help me :) also as a side question that might be related is there a way to choose which julia executable juliacall should use?

One more small thing is I managed to use it in both ubuntu and windows.

@cjdoris
Copy link
Collaborator

cjdoris commented Feb 21, 2022

I can't reproduce this on WSL.

The line Activating project at ~/Repos/juliacall doesn't appear for me, and is the problem for you, because it means PythonCall is being installed into the wrong project.

My guess is that you have Pkg.activate("~/Repos/juliacall") in a startup.jl somewhere, or similar.

@gpucce
Copy link
Author

gpucce commented Feb 21, 2022

Thanks you guessed the right issue!

@gpucce gpucce closed this as completed Feb 21, 2022
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

2 participants