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 install PyPI packages (cirq) for PyCall in Windows (Mac?) #2

Open
madhavkrishnan opened this issue Oct 29, 2020 · 0 comments
Open

Comments

@madhavkrishnan
Copy link

madhavkrishnan commented Oct 29, 2020

This is related to how PyCall is installed in Windows / Mac as opposed to Linux.

From PyCall documentation :

By default on Mac and Windows systems, Pkg.add("PyCall") or Pkg.build("PyCall") will use the Conda.jl package to install a minimal Python distribution (via Miniconda) that is private to Julia (not in your PATH). You can use the Conda Julia package to install more Python packages, and import Conda to print the Conda.PYTHONDIR directory where python was installed. On GNU/Linux systems, PyCall will default to using the python3 program (if any, otherwise python) in your PATH. '

PyCall will by default use this julia only conda installation.

You can use Conda.jl to install packages using the methods described here. However the default installed version does not support installing PyPI packages with pip.

It is possible to get PyCall to use an existing Conda installation and point to a virtual env it will name conda_jl as described here. This env can be activated as usual with conda activate conda_jl from the terminal and packages can be installed directly. This workaround is less desirable than the following approach

The latest version experimental version of Conda.jl has support for PyPI packages and can be installed from julia by running,

Pkg.add(PackageSpec(name="Conda", rev="master")

You might need to run Pkg.build("Conda") if Conda is not build automatically. Now, you can run the following code to install a PyPI only package such as cirq,

using Conda
Conda.pip_interop(true)
Conda.pip("install", "cirq")

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

1 participant