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

Package with pip dep fails with Jupyter notebook on Windows #226

Closed
madhavkrishnan opened this issue Sep 27, 2022 · 5 comments
Closed

Package with pip dep fails with Jupyter notebook on Windows #226

madhavkrishnan opened this issue Sep 27, 2022 · 5 comments

Comments

@madhavkrishnan
Copy link

I am writing a package with a pip depencency which works correctly in the REPL but fails in a Jupyter notebook on Windows. However, it works correctly on Ubuntu using WSL.

OS : Win 10
Julia 1.8.1
PythonCall 0.9.6

The error message I get from CondaPkg is

CondaPkg Installing Pip packages
failed to create process.

I've made MWE here https://github.com/madhavkrishnan/TestPkg.jl. Adding relavant files here for ease.

src/TestPkg.jl

module TestPkg

using PythonCall

const scipy = PythonCall.pynew() # initially NULL

function __init__()
	PythonCall.pycopy!(scipy, pyimport("scipy"))
end


end

CondaPkg.toml

[deps]
python = ">=3.5,<4"


[pip.deps]
scipy = ""

Failing notebook - https://github.com/madhavkrishnan/TestPkg.jl/blob/main/debug/test.ipynb

Working script
debug/test.jl

using TestPkg

println(TestPkg.scipy)

println(TestPkg.scipy.sin(π / 4))

Could someone check if this is reproducable or if it is a problem with my system?

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 27, 2022

Running a JupyterLab notebook on Windows 11 with the following code worked for me:

import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/madhavkrishnan/TestPkg.jl")
using TestPkg
TestPkg.scipy

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 27, 2022

I tried again in a VSCode notebook (since it appears that's what you're using) and that worked too.

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 27, 2022

Anyway you should use the conda scipy package instead of the pip one.

@madhavkrishnan
Copy link
Author

Thanks for the response @cjdoris. The scipy package is just in the MWE, I actually needed a package only available on PyPI. The code snippet you left worked for me as well, I think because it activated a temp environment. I think the issue was perhaps my environments were somehow messed up. I removed all Julia installations completely and did a clean install and everything works fine now. I'll go ahead and close this issue. Thanks for the help.

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 28, 2022

OK cool. Environments shouldn't get messed up - if it happens again and you suspect this package is to blame, please open another issue.

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