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

PyCall no longer used #124

Merged
merged 1 commit into from Oct 20, 2023
Merged

Conversation

PallHaraldsson
Copy link
Contributor

No description provided.

@PallHaraldsson
Copy link
Contributor Author

Do not merge. I'm not sure a version has been tagged. This is just a suggested text. PyCall is also still mentioned in two other files.

@ChrisRackauckas
Copy link
Member

The version is already tagged, so it's good to improve this.

@ChrisRackauckas ChrisRackauckas merged commit df65e85 into SciML:master Oct 20, 2023
@PallHaraldsson PallHaraldsson deleted the patch-1 branch October 20, 2023 11:13
@PallHaraldsson
Copy link
Contributor Author

PallHaraldsson commented Oct 20, 2023

That was quick. I'm not really a SciML user or dev, so I didn't need credit.

I'm at best a tester of SciML, out of curiosity to see how well PythonCall works with it (since I suggested that change). I get a wall of text, ERRORs and Warnings, likely not because of it though.

While I think I know why, many Python users would probably not (nor would have my environment, the likely cause):

>>> diffeqpy.install()
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.9/Project.toml`
  No Changes to `~/.julia/environments/v1.9/Manifest.toml`
Precompiling project...
  ✗ REPLCompletions
  ✗ Adapt → AdaptStaticArraysExt
  ✗ ArbFloats
  ✗ SteadyStateDiffEq
  ✗ DifferentialEquations
  147 dependencies successfully precompiled in 217 seconds. 282 already precompiled.
  5 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages
  26 dependencies had warnings during precompilation:
┌ SparseDiffTools [47a9eef4-7e08-11e9-0b38-333d64bd3804]
│  ERROR: LoadError: ArgumentError: Package AdaptStaticArraysCoreExt does not have Adapt in its dependencies:
│  - You may have a partially installed environment. Try `Pkg.instantiate()`

[..]


┌ ShaderAbstractions [65257c39-d410-5151-9873-9b3e5be5013e]
│  ERROR: LoadError: ArgumentError: Package AdaptStaticArraysCoreExt does not have Adapt in its dependencies:
│  - You may have a partially installed environment. Try `Pkg.instantiate()`

│  ┌ Error: Error during loading of extension AdaptStaticArraysExt of Adapt, use `Base.retry_load_extensions()` to retry.

│  WARNING: Method definition lmul!(LinearAlgebra.Givens{T} where T, Nothing) in module GenericSVD at /home/pharaldsson/.julia/packages/GenericSVD/cT5Cu/src/utils.jl:28 overwritten in module GenericLinearAlgebra at /home/pharaldsson/.julia/packages/GenericLinearAlgebra/skQkq/src/svd.jl:7.
│    ** incremental compilation may be fatally broken for this module **

┌ GridLayoutBase [3955a311-db13-416c-9275-1d80ed98e5e9]
│  ERROR: LoadError: ArgumentError: Package AdaptStaticArraysCoreExt does not have Adapt in its dependencies:
│  - You may have a partially installed environment. Try `Pkg.instantiate()`
│    to ensure all packages in the environment are installed.
│  - Or, if you have AdaptStaticArraysCoreExt checked out for development and have
│    added Adapt as a dependency but haven't updated your primary
│    environment's manifest file, try `Pkg.resolve()`.

ERROR: LoadError: Failed to precompile DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa] to "/home/pharaldsson/.julia/compiled/v1.9/DifferentialEquations/jl_lQJf1z".
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2300
 [3] compilecache
   @ ./loading.jl:2167 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1805
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1660
 [6] macro expansion
   @ ./loading.jl:1648 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1611
in expression starting at /home/pharaldsson/.local/lib/python3.10/site-packages/diffeqpy/install.jl:6
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pharaldsson/.local/lib/python3.10/site-packages/diffeqpy/__init__.py", line 11, in install
    subprocess.check_call(['julia', os.path.join(script_dir, 'install.jl')])
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['julia', '/home/pharaldsson/.local/lib/python3.10/site-packages/diffeqpy/install.jl']' returned non-zero exit status 1.

@ChrisRackauckas
Copy link
Member

It's because you have weird packages in your environment. Normal people from Python won't have a whole environment full of junk to start with that block the packages from installing.

@PallHaraldsson
Copy link
Contributor Author

Yes, what I thought. Is there a way or should there be a way that the package would use a clean environment? Python users shouldn't have to know or care about what Julia environments are ideally. Nor if they later start messing with Julia and install packages, screw things up for already installed Python "[impure] world".

@ChrisRackauckas
Copy link
Member

@LilithHafner do you know if there's a way that we can force this to always use an environment we control?

@LilithHafner
Copy link
Member

Strange. I thaught this did it

return Main.seval(f"import Pkg; Pkg.activate(\"diffeqpy\", shared=true); import {names}; {names}")

@LilithHafner
Copy link
Member

What version of diffeqpy are you using?

@PallHaraldsson
Copy link
Contributor Author

PallHaraldsson commented Oct 20, 2023

EDIT: it works now with later version (installation, didn't go further yet).

I had version 1.1.0, or so I recall, pretty sure (maybe can't confirm since I now updated to later):

I had to do (I suppose will be default soon, just quote new) and am trying again:
pip install diffeqpy=2.2.0

I think it may be working now, i.e. I'm not seeing my environment, only that SciML is huge):

   Updating `~/.julia/environments/diffeqpy/Project.toml`
  [0c46a032] + DifferentialEquations v7.11.0
  [961ee093] + ModelingToolkit v8.72.2
  [1dea7af3] + OrdinaryDiffEq v6.58.0
  [6099a3de] + PythonCall v0.9.14
    Updating `~/.julia/environments/diffeqpy/Manifest.toml`
  [47edcb42] + ADTypes v0.2.4
⌅ [c3fe647b] + AbstractAlgebra v0.32.5
[..]

At least not all at latest, but plausibly not a problem.

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

Successfully merging this pull request may close these issues.

None yet

3 participants