PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

how to make sure certain version of package is fetched

Open AbhimanyuAryan opened this issue 2 years ago • 2 comments

I'm checking seaborn.jls' pandas.jls' code and the following line basically handles importing logic

copy!(seaborn, pyimport_conda("seaborn", "seaborn"))

How do you make sure that it doesn't just get any version of seaborn but a specific version. Let's say 0.11.1 instead of 0.11.2

AbhimanyuAryan avatar Jan 09 '22 19:01 AbhimanyuAryan

Bump. The SciPy distribution on Windows has been broken since v1.6.1

https://stackoverflow.com/questions/68726800/error-finding-dependencies-in-anaconda-environment-when-running-jupyter-notebook

so I'm trying to figure out how to do pyimport_conda to force scipy to v1.6.1 since otherwise SciPyDiffEq.jl will fail on Windows.

ERROR: LoadError: InitError: PyError (PyImport_ImportModule) <class 'FileNotFoundError'>
FileNotFoundError("Could not find module 'C:\\Users\\accou\\.julia\\conda\\3\\lib\\site-packages\\scipy\\.libs\\libbanded5x.EVQBRDRR4US53IHPKU7YBJU2OAGXVHOG.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.")
  File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\__init__.py", line 136, in <module>
    from . import _distributor_init
  File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\accou\.julia\conda\3\lib\ctypes\__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)

Stacktrace:
  [1] pyimport(name::String)
    @ PyCall C:\Users\accou\.julia\packages\PyCall\L0fLP\src\PyCall.jl:550
  [2] pyimport_conda(modulename::String, condapkg::String, channel::String)
    @ PyCall C:\Users\accou\.julia\packages\PyCall\L0fLP\src\PyCall.jl:714
  [3] __init__()
    @ SciPyDiffEq C:\Users\accou\.julia\packages\SciPyDiffEq\HEvDK\src\SciPyDiffEq.jl:18
  [4] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base .\loading.jl:768
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:854
  [6] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1097
  [7] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1013
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:997
  [9] include(fname::String)
    @ Base.MainInclude .\client.jl:451
 [10] top-level scope
    @ none:6
during initialization of module SciPyDiffEq
in expression starting at C:\Users\accou\.julia\packages\SciPyDiffEq\HEvDK\test\runtests.jl:1

caused by: PyError (PyImport_ImportModule) <class 'FileNotFoundError'>
FileNotFoundError("Could not find module 'C:\\Users\\accou\\.julia\\conda\\3\\lib\\site-packages\\scipy\\.libs\\libbanded5x.EVQBRDRR4US53IHPKU7YBJU2OAGXVHOG.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.")
  File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\__init__.py", line 136, in <module>
    from . import _distributor_init
  File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\accou\.julia\conda\3\lib\ctypes\__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)

Stacktrace:
  [1] pyimport(name::String)
    @ PyCall C:\Users\accou\.julia\packages\PyCall\L0fLP\src\PyCall.jl:550
  [2] pyimport_conda(modulename::String, condapkg::String, channel::String)
    @ PyCall C:\Users\accou\.julia\packages\PyCall\L0fLP\src\PyCall.jl:708
  [3] __init__()
    @ SciPyDiffEq C:\Users\accou\.julia\packages\SciPyDiffEq\HEvDK\src\SciPyDiffEq.jl:18
  [4] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base .\loading.jl:768
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:854
  [6] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1097
  [7] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1013
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:997
  [9] include(fname::String)
    @ Base.MainInclude .\client.jl:451
 [10] top-level scope
    @ none:6
ERROR: Package SciPyDiffEq errored during testing

ChrisRackauckas avatar Jan 23 '22 13:01 ChrisRackauckas

At least PyCall respects versions you've fixed, so I manually did C:\Users\accou\.julia\conda\3\condabin>conda install scipy=1.6.1 and then ]test SciPyDiffEq works. Exposing this directly from Julia though would be helpful. But anyways, that's a workaround for anyone who finds this issue.

ChrisRackauckas avatar Jan 23 '22 13:01 ChrisRackauckas