JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.47k stars 187 forks source link

I Can't import "finpy-tse" using pyimport #1003

Closed shayandavoodii closed 1 year ago

shayandavoodii commented 2 years ago

I installed the finpy-tse python package using Conda.jl with this command:

julia> using Conda, PyCall

julia> Conda.pip("install", "finpy-tse")

After the complete installation, I tried to import it using PyCall:

julia> fpy = pyimport("finpy-tse")
ERROR: PyError (PyImport_ImportModule

The Python package finpy-tse could not be imported by pyimport. Usually this means
that you did not install finpy-tse in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package.  To install the finpy-tse module, you can
use `pyimport_conda("finpy-tse", PKG)`, where PKG is the Anaconda
package that contains the module finpy-tse, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python.   As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'finpy-tse'")

Stacktrace:
 [1] pyimport(name::String)
   @ PyCall C:\Users\Shayan\.julia\packages\PyCall\ygXW2\src\PyCall.jl:558
 [2] top-level scope
   @ REPL[6]:1

But when I check for the package, whether it exists or not:

julia> "finpy-tse" in Conda._installed_packages()
true

What is the problem?


smafghahi commented 1 year ago

Hi For importing after installation, you must use "finpy_tse" instead of "finpy-tse".