MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia
https://astroautomata.com/PySR
Apache License 2.0
2.19k stars 207 forks source link

[BUG] *Installation difficulties on Windows 10, Py3.9* #207

Closed ganatma closed 6 months ago

ganatma commented 1 year ago

Describe the bug

Facing issues while installing pysr through

import pysr pysr.install()

julia.tools.PyCallInstallError: Precompiling PyCall failed. Fatal Python error: init_import_size: Failed to import the site module

Version (please include the following information):

Configuration

Error message

Julia Version 1.8.2
Commit 36034abf26 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
      Microsoft Windows [Version 10.0.19042.2130]
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz:
                 speed         user         nice          sys         idle          irq
       #1-12  2592 MHz   10071994            0      7263058    161157713       326495  ticks
  Memory: 15.723960876464844 GB (6015.3671875 MB free)
  Uptime: 14874.625 sec
  Load Avg:  0.0  0.0  0.0
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores
Environment:
  JULIA_PROJECT = @pysr-0.11.4
  HOMEDRIVE = C:
  HOMEPATH = \Users\nakk116
  PATH = C:\JCP\symreg\Scripts;C:\Program Files (x86)\Google\Chrome\Application;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\DVC (Data Version Control);C:\Program Files\Git\cmd;C:\Users\nakk116\AppData\Local\Microsoft\WindowsApps;;C:\Users\nakk116\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\nakk116\AppData\Local\Programs\Julia-1.8.2\bin
  PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  PSMODULEPATH = C:\Program Files\WindowsPowerShell\Modules;C:\windows\system32\WindowsPowerShell\v1.0\Modules
│    ArgumentError: Package PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] is required but does not seem to be installed:
│     - Run `Pkg.instantiate()` to install all recorded dependencies.
│ 
│    Stacktrace:
│     [1] _require(pkg::Base.PkgId)
│       @ Base .\loading.jl:1306
│     [2] _require_prelocked(uuidkey::Base.PkgId)
│       @ Base .\loading.jl:1200
│     [3] macro expansion
│       @ .\lock.jl:223 [inlined]
│     [4] require(uuidkey::Base.PkgId)
│       @ Base .\loading.jl:1195
│     [5] top-level scope
│       @ C:\JCP\symreg\Lib\site-packages\julia\install.jl:36
│     [6] include(mod::Module, _path::String)
│       @ Base .\Base.jl:419
│     [7] exec_options(opts::Base.JLOptions)
│       @ Base .\client.jl:303
│     [8] _start()
│       @ Base .\client.jl:522
└ @ Main C:\JCP\symreg\Lib\site-packages\julia\install.jl:38
[ Info: Installing PyCall...
  Installing known registries into `C:\Users\nakk116\.julia`
    Updating registry at `C:\Users\nakk116\.julia\registries\General.toml`
   Resolving package versions...
   Installed Parsers ──────── v2.4.2
   Installed VersionParsing ─ v1.3.0
   Installed Conda ────────── v1.7.0
   ...
  [83775a58] + Zlib_jll v1.2.12+3
  [8e850b90] + libblastrampoline_jll v5.1.1+0
  [8e850ede] + nghttp2_jll v1.48.0+0
    Building Conda ─→ `C:\Users\nakk116\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\6e47d11ea2776bc5627421d59cdcc1296c058071\build.log`
    Building PyCall → `C:\Users\nakk116\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\53b8b07b721b77144a0fbbbc2675222ebf40a02d\build.log`
Precompiling project...
  8 dependencies successfully precompiled in 8 seconds. 4 already precompiled.

**Precompiling PyCall...
Fatal Python error: init_import_size: Failed to import the site module**
Python runtime state: initialized
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\site.py", line 73, in <module>
    import os
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\os.py", line 29, in <module>  
    from _collections_abc import _check_methods
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\_collections_abc.py", line 12, in <module>
    GenericAlias = type(list[int])
TypeError: 'type' object is not subscriptable
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\JCP\symreg\lib\site-packages\pysr\julia_helpers.py", line 78, in install
    julia.install(quiet=quiet)
  File "C:\JCP\symreg\lib\site-packages\julia\tools.py", line 127, in install
    raise PyCallInstallError("Precompiling")
julia.tools.PyCallInstallError: Precompiling PyCall failed.

Important information from Julia may be printed before Python's Traceback

MilesCranmer commented 1 year ago

Are you installing from pip or conda? (My guess is pip?)

MilesCranmer commented 1 year ago

Do you see this error anywhere else? It doesn't look like it is caused by PySR, but from some issue with your Python environment. See https://stackoverflow.com/q/65670259/2689923

See this section of the errror:

atal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\site.py", line 73, in
import os
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\os.py", line 29, in
from _collections_abc import _check_methods
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib_collections_abc.py", line 12, in
GenericAlias = type(list[int])
TypeError: 'type' object is not subscriptable

Looks like this part of the Python install is broken?

J-You commented 9 months ago

Hi, @ganatma , this error can also be reproduced on my windows system. could you pls tell me how do you fix it?

MilesCranmer commented 6 months ago

Presumably fixed by #535