You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I used reticulate to install python 3.12:latest and configure a virtual environment. In that environment, I have installed spyder whose startup script is just a python script.
the main command to launch spyder is the following: from spyder.app.start import main
I tested two scenarios: 1] Use reticulate::repl_python(): copy this command and get:
_Python 3.12.7 (/home/fafesche/.myEnv/12_IAE-M1/bin/python)
Reticulate 1.39.0 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
from spyder.app.start import main
Traceback (most recent call last):
File "", line 1, in
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 96, in _run_hook
module = hook()
^^^^^^
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 120, in _hook
return find_and_load(name, import)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/fafesche/.myEnv/12_IAE-M1/lib/python3.12/site-packages/spyder/app/start.py", line 22, in
import logging
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 96, in _run_hook
module = hook()
^^^^^^
File "/home/fafesche/R/x86_64-pc-linux-gnu-library/4.4/reticulate/python/rpytools/loader.py", line 120, in hook
return find_and_load(name, import)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'logging'
2] Use python - from the environment - using source activate (under linux):
same command no error.
This failed under linux (mint) and under Windows (v10). I get the same error in both cases.
I also tried to launch the spyder script using reticulate::py_run_file() got the same error.
My py_config() is the following: > py_config()
python: /home/fafesche/.myEnv/12_IAE-M1/bin/python
libpython: /home/fafesche/.pyenv/versions/3.12.7/lib/libpython3.12.so
pythonhome: /home/fafesche/.myEnv/12_IAE-M1:/home/fafesche/.myEnv/12_IAE-M1
version: 3.12.7 (main, Oct 21 2024, 16:36:21) [Clang 14.0.6 ]
numpy: /home/fafesche/.myEnv/12_IAE-M1/lib/python3.12/site-packages/numpy
numpy_version: 2.1.2
To configure my virtual env, I have used the environment variable WORK_HOME as documented to put the virtual environment into another directory than the default one.
The encountered error means that it is not possible to run spyder from the repl_python() of reticulate which could be cool when working with students :)
Thanks in advance,
Fabien
The text was updated successfully, but these errors were encountered:
Hi,
a minimal script which mimics what I did - perhaps incorrectly - is the following:
Sys.setenv(WORKON_HOME="C:/IAEpython")
library(reticulate)
pver<-"3.12"reticulate::install_python(version=pver)
myEnv.name<-"myEnv"reticulate::virtualenv_create(myEnv.name, python=pver)
reticulate::use_virtualenv(myEnv.name)
fn.pkg_install<-function(name="", my.env="") {
if (requireNamespace("reticulate", quietly=TRUE)) {
if (!reticulate::py_module_available(name)) {
reticulate::py_install(name, my.env)
return(TRUE)
}
}
return(FALSE)
}
pkgs<- c("pandas", "spyder")
res<- sapply(pkgs, fn.pkg_install, my.env=myEnv.name)
reticulate::repl_python()
# Enter from spyder.app.start import main# -> ModuleNotFoundError: No module named 'logging' after a long trace
If I activate the python env using command-line then launch python - the one of the environment which is btw the only python installed in the system - i get no error from this import and thus spyder is perfectly working in that environment.
Thanks in advance,
Fabien
Hi,
I used reticulate to install python 3.12:latest and configure a virtual environment. In that environment, I have installed spyder whose startup script is just a python script.
the main command to launch spyder is the following: from spyder.app.start import main
I tested two scenarios:
1] Use reticulate::repl_python(): copy this command and get:
_Python 3.12.7 (/home/fafesche/.myEnv/12_IAE-M1/bin/python)
Reticulate 1.39.0 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
2] Use python - from the environment - using source activate (under linux):
same command no error.
This failed under linux (mint) and under Windows (v10). I get the same error in both cases.
I also tried to launch the spyder script using reticulate::py_run_file() got the same error.
My py_config() is the following:
> py_config()
python: /home/fafesche/.myEnv/12_IAE-M1/bin/python
libpython: /home/fafesche/.pyenv/versions/3.12.7/lib/libpython3.12.so
pythonhome: /home/fafesche/.myEnv/12_IAE-M1:/home/fafesche/.myEnv/12_IAE-M1
version: 3.12.7 (main, Oct 21 2024, 16:36:21) [Clang 14.0.6 ]
numpy: /home/fafesche/.myEnv/12_IAE-M1/lib/python3.12/site-packages/numpy
numpy_version: 2.1.2
To configure my virtual env, I have used the environment variable WORK_HOME as documented to put the virtual environment into another directory than the default one.
The encountered error means that it is not possible to run spyder from the repl_python() of reticulate which could be cool when working with students :)
Thanks in advance,
Fabien
The text was updated successfully, but these errors were encountered: