[BUG] Installation fails
Describe the bug After installing from conda in a Python 3.9 environment, installation fails with the following
julia.core.JuliaError: Exception 'ReadOnlyMemoryError()' occurred while calling julia code Pkg.add(spec, io=stderr)
Version (please complete the following information):
- OS: Ubuntu
- Version 20.04.2 LTS (Focal Fossa)
- Does the bug appear with the latest version of PySR? Yes
Configuration
- What are your PySR settings? None. The installed version is 0.7.9 (pyh6c4a22f_0 from conda-forge)
- What dataset are you running on? None
Error message
To silence this warning, you can run pysr.silence_julia_warning() after importing pysr.
warnings.warn(
Activating new environment at `~/.julia/environments/pysr-0.7.9/Project.toml`
Cloning git-repo `https://github.com/MilesCranmer/SymbolicRegression.jl`
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home//anaconda3/envs/stable/lib/python3.9/site-packages/pysr/sr.py", line 46, in install
_add_sr_to_julia_project(Main, io_arg)
File "/home//anaconda3/envs/stable/lib/python3.9/site-packages/pysr/sr.py", line 343, in _add_sr_to_julia_project
Main.eval(f"Pkg.add(spec, {io_arg})")
File "/home//anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 621, in eval
ans = self._call(src)
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 549, in _call
self.check_exception(src)
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 603, in check_exception
raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
julia.core.JuliaError: Exception 'ReadOnlyMemoryError()' occurred while calling julia code:
Pkg.add(spec, io=stderr)
Additional context
Where is your anaconda3 folder located? The error trace back seems to reference two different folders: /home/anaconda3 and /home/em/anaconda3 - maybe do you have two conflicting installations?
Strange, as I copy-pasted the trace back. No, I've only got one anaconda installation, just multiple envs. But just ran again (same env and everything) and now the paths look right. Alas, the error persists.
Environment:
CONDA_BACKUP_FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
CONDA_BACKUP_LDFLAGS = -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/em/anaconda3/lib -Wl,-rpath-link,/home/em/anaconda3/lib -L/home/em/anaconda3/lib
JAVA_HOME = /usr/lib/jvm/java-11-openjdk-amd64
CONDA_BACKUP_DEBUG_CFLAGS = -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -ffunction-sections -pipe -isystem /home/em/anaconda3/include
CONDA_BACKUP_DEBUG_CPPFLAGS = -D_DEBUG -D_FORTIFY_SOURCE=2 -Og -isystem /home/em/anaconda3/include
CONDA_BACKUP_DEBUG_CXXFLAGS = -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -ffunction-sections -pipe -isystem /home/em/anaconda3/include
CONDA_BACKUP_DEBUG_FORTRANFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
HOME = /home/em
CONDA_BACKUP_CFLAGS = -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
CONDA_BACKUP_CXXFLAGS = -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
TERM = xterm-256color
CONDA_BACKUP_CMAKE_PREFIX_PATH = /home/em/anaconda3:/home/em/anaconda3/x86_64-conda-linux-gnu/sysroot/usr
CONDA_BACKUP_CPPFLAGS = -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/em/anaconda3/include
CONDA_BACKUP_DEBUG_FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
PATH = /home/em/anaconda3/envs/stable/bin:/home/em/anaconda3/condabin:/home/em/.local/bin:/home/em/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
CONDA_BACKUP_FORTRANFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/em/anaconda3/include
[ Info: Julia executable: /home/em/anaconda3/envs/stable/bin/julia
[ Info: Trying to import PyCall...
┌ Info: PyCall is already installed and compatible with Python executable.
│
│ PyCall:
│ python: /home/em/anaconda3/envs/stable/bin/python
│ libpython: /home/em/anaconda3/envs/stable/lib/libpython3.9.so.1.0
│ Python:
│ python: /home/em/anaconda3/envs/stable/bin/python
└ libpython:
/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/pysr/sr.py:318: UserWarning:
Your Python version is statically linked to libpython. For example, this could be the python included with conda, or maybe your system's built-in python.
This will still work, but the precompilation cache for Julia will be turned off, which may result in slower startup times on the initial pysr() call.
To install a Python version that is dynamically linked to libpython, pyenv is recommended (https://github.com/pyenv/pyenv). With pyenv, you can run: `PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.10` to install Python 3.9.10 with dynamic linking.
To silence this warning, you can run pysr.silence_julia_warning() after importing pysr.
warnings.warn(
Activating new environment at `~/.julia/environments/pysr-0.7.9/Project.toml`
Cloning git-repo `https://github.com/MilesCranmer/SymbolicRegression.jl`
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/pysr/sr.py", line 46, in install
_add_sr_to_julia_project(Main, io_arg)
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/pysr/sr.py", line 343, in _add_sr_to_julia_project
Main.eval(f"Pkg.add(spec, {io_arg})")
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 621, in eval
ans = self._call(src)
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 549, in _call
self.check_exception(src)
File "/home/em/anaconda3/envs/stable/lib/python3.9/site-packages/julia/core.py", line 603, in check_exception
raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
julia.core.JuliaError: Exception 'ReadOnlyMemoryError()' occurred while calling julia code:
Pkg.add(spec, io=stderr)
Very strange. Any chance you installed conda with sudo? It looks like it’s unable to write because of permission issues.
Strange indeed. Everything is in my home directory and I've never had to change permissions on anaconda's folders. Would you know what path is problematic? Also, I've checked, and ~/.julia/environments/pysr-0.7.9 does not exist.
This looks similar in some ways: https://github.com/JuliaLang/julia/issues/39396
Maybe you are running out of RAM? How much RAM do you have?
1 TB, half of which is available - can free up more, though I'd be very surprised if that mattered. Info, as printed by pysr.install()
Platform Info:
OS: Linux (x86_64-conda-linux-gnu)
Ubuntu 20.04.2 LTS
uname: Linux 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64
CPU: AMD EPYC 7702P 64-Core Processor:
speed user nice sys idle irq
#1-128 1499 MHz 1189067606 s 89796 s 73479266 s 8341110380 s 0 s
Memory: 1003.5033874511719 GB (455850.2890625 MB free)
Yes, that's definitely enough RAM!! I was more wondering if it was like on a tiny virtual machine or something and running out of memory. This bug is really perplexing me.
Could you try each of the following potential solutions?
- Delete the Julia registry using
rm ~/.julia/registries/*and then re-runpysr.install(). - Create a new conda environment just for PySR, with
conda create -n pysr pysr, and see if it works in a fresh environment.
Also, make sure your conda is up to date (conda update -n base conda), but I'm not sure if that's relevant for this.
Presumably fixed by #535