I’ve tried to install PyCall numerous times, but can never get it to work. I’ve tried manually setting the environment variable PYTHON to the directory where the lastest python.exe file is, but that doesn’t work. When I try Pkg.build(“PyCall”) I get a bunch of undecipherable errors. I’m almost at the point of removing both Python and Julia completely and trying to start over. Or can I simply get by without PyCall?
It can be tricky. Which Julia version are you using? Which operating system?
Which Python package to you want to use, if any?
Have a look at GitHub - aenarete/ControlPlots.jl: Easy to use plotting for control engineers and students
If you use Julia 1.12, you might have to launch it with julia -t 1,0
It might be easier to use PythonPlot.jl or PythonCall.jl
Thank you for getting back to me. I may have gotten myself in trouble with Python, as I’d had installed from the Python website, but had also installed Anaconda. I’m going to try to get rid of Anaconda anyway, as I don’t think I need it nowadays.
I’m using the latest version of Julia that I got by running juliaup update. So it looks like i’m using 1.12.
I’m running Julia several ways:
- Through Visual Studio Code, both running .jl files and using the REPL window at times
- Calling up Julia from the terminal window
- I may be using Pluto as well, as I’m currently taking an MIT online course that uses Julia.
My operating system is Windows 11, which I upgraded to last fall. My computer has a CPU with 10 cores and 32 GB RAM.
I will have a look at the GitHub site you recommended. BTW, if I can get along without Python altogether, I’ll gladly do so. I’m not very fond of it for a number of reasons. I do most of my stats work in R, but I want to develop an app to estimate discrete choice models. I currently do a lot of work in C#, although I’ll revert to C sometimes as a trusty standby.
I did try to install PythonCall.jl, but it seemed to want PyCall, so it failed to install.
Again, thank you so much for reaching out to me.
If you don’t need it, don’t use it. If you need it, please explain for what purpose. There might be good Julia alternatives that do not depend on Python.
Probably you have a bunch of environment variables from your multiple Python installations that are confusing things. (Does Python run okay when you launch it separately?)
Realize also that PyCall, by default, will install its own Miniconda Python distro, which might get confused if you have global environment variables (like PYTHONPATH) set from your other install.
You need to decide which Python you want to use. If you want to use the one that Julia/PyCall installs, then unset your Python-related environment variables. On the other hand, if you want to manage your own Python installation, you should (a) pick one and make sure it works and (b) tell PyCall to use it by setting the PYTHON environment variable when building PyCall (as explained in the documentation).
PythonCall does not use PyCall. But it also installs its own Python by default IIRC, which will also be confused if your environment is littered with variables from multiple other Python installations.
Could you describe what you would like to do with PyCall.jl or if there is a particular package you would like to install that requires it? If we know this, I think we can better advise on the path forward.
It seems that there are a number of packages that require PyCall. One of them is PhysicalConstants
That doesn’t seem to be true: I think you may be confusing weak dependencies (package extensions) with requirements?
For example, PhysicalConstants.jl depends on Roots.jl (to solve for the Lambert W function in Wien’s law constants, apparently?), and Roots.jl has a package extension where it can optionally integrate with SymPy.jl (which requires PyCall.jl) if it’s installed, but it doesn’t require it.