Skip to content

Importing python modules failed from the specified python #252

Closed
@shayandavoodii

Description

@shayandavoodii

Today I installed the latest version of PythonCall.jl (v0.9.10) package and started with:

julia> using PythonCall

julia> ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
"Null"

julia> ENV["JULIA_PYTHONCALL_EXE"] = raw"C:\Users\Shayan\AppData\Local\Programs\Python\Python310\python.exe"
"C:\\Users\\Shayan\\AppData\\Local\\Programs\\Python\\Python310\\python.exe"

Then I closed the Julia session and started a new one to continue. Then I failed to import the numpy package via pyimport:

julia> using PythonCall

julia> pyimport("numpy")
ERROR: Python: ModuleNotFoundError: No module named 'numpy'
Python stacktrace: none
Stacktrace:
 [1] pythrow()
   @ PythonCall C:\Users\Shayan\.julia\packages\PythonCall\3GRYN\src\err.jl:94
 [2] errcheck
   @ C:\Users\Shayan\.julia\packages\PythonCall\3GRYN\src\err.jl:10 [inlined]
 [3] pyimport(m::String)
   @ PythonCall C:\Users\Shayan\.julia\packages\PythonCall\3GRYN\src\concrete\import.jl:11
 [4] top-level scope
   @ REPL[2]:1

Also, I tried setting the path to the directory rather than the executable Python:

julia> ENV["JULIA_PYTHONCALL_EXE"] = raw"C:\Users\Shayan\AppData\Local\Programs\Python\Python310"
"C:\\Users\\Shayan\\AppData\\Local\\Programs\\Python\\Python310"

But, still, I couldn't import numpy. Note that I made sure that the numpy is installed in the specified environment:

C:\Users\Shayan>pip list numpynumpy              1.23.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions