Closed ejlevine closed 10 months ago
Hi @ejlevine, I wasn't able to recreate the failure. I ran that notebook in a freshly made conda environment on a Mac M1 laptop and everything worked as expected. So I'm not sure what's going on.
@ProjectPythia/infrastructure any ideas what to look at here?
I don't know if this is related, but I noticed that we have some obsolete version pins in our environment file. I just opened https://github.com/ProjectPythia/pythia-foundations/pull/423 to remove those.
It might be worth trying to create a fresh version of the pythia-book-dev
environment once #423 is merged.
Hi @ejlevine , you are using the Spyder IDE to run the notebooks I believe.
The error is probably due to the IDE configuration, i.e. even though you ran conda activate pythia-book-dev
in terminal, it only applies to within that terminal, and your Spyder IDE might probably be set to use a different conda env as Python interpreter; you can check this from its configs. When running notebooks via Spyder, it is probably using the conda env that is set as Python interpreter within its preferences.
For simplicity, could you please first try using jupyter lab
to run pandas.ipynb
as described here and let us know if you are able to access pythia-datasets
?
If yes, you can either keep using jupyter-lab, which is recommended, or set your Spyder to use the pythia-book-dev
environment for these notebooks.
I found that the commands
from pythia_datasets import DATASETS filepath = DATASETS.fetch ('enso_data.csv')
work fine with ~/miniconda3/envs/pythia-book-dev/bin/ipython.
I ran 'spyder --debug-info verbose' and got the following message: An error occurred while starting the kernel The Python environment or installation whose interpreter is located at /XXXXXX/miniconda3/envs/pythia-book-dev/bin/python doesn't have the spyder-kernels module or the right version of it installed (>= 2.4.0 and < 2.5.0). Without this module is [sic] not possible for Spyder to create a console for you. You can install it by activating your environment first (if necessary) and then running in a system terminal: conda install spyder-kernels=2.4
So I ran the following commands:
conda config --set solver libmamba # The install didn't work with the 'classic' solver conda install spyder-kernels
conda list | grep spyder spyder-kernels 2.4.4 py311h06a4308_0
And now the DATASETS commands work in spyder:
import pandas as pd from pythia_datasets import DATASETS filepath = DATASETS.fetch ('enso_data.csv') filepathOut[4]: ~/.cache/pythia-datasets/enso_data.csv'
thanks,
-eric
------- Original Message ------- On Friday, August 25th, 2023 at 12:59 AM, Orhan Eroglu @.***> wrote:
Hi @.***(https://github.com/ejlevine) , you are using the Spyder IDE to run the notebooks I believe.
The error is probably due to the IDE configuration, i.e. even though you ran conda activate pythia-book-dev in terminal, it only applies to within that terminal, and your Spyder IDE might probably be set to use a different conda env as Python interpreter; you can check this from its configs. When running notebooks via Spyder, it is probably using the conda env that is set as Python interpreter within its preferences.
For simplicity, could you please first try using jupyter lab to run pandas.ipynb as described here and let us know if you are able to access pythia-datasets?
If yes, you can either keep using jupyter-lab, which is recommended, or set your Spyder to use the pythia-book-dev environment for these notebooks.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@ejlevine thanks for sharing your solution with us!
Is this a general-enough problem that we should include documentation on "how to run Foundations examples in Spyder?"
Is this a general-enough problem that we should include documentation on "how to run Foundations examples in Spyder?"
This seems like an IDE-specific issue with conda environments, and I don't believe it should be documented under Pythia
I've set up the Project Pythia environment on my openSUSE Leap 15.4 linux vm with miniconda3 using the following commands:
conda env create --force -f https://raw.githubusercontent.com/ProjectPythia/pythia-foundations/main/environment.yml conda activate pythia-book-dev
I've gone through most of the modules under https://foundations.projectpythia.org/landing-page.html using spyder, and I'm now trying to do the Pandas module https://foundations.projectpythia.org/core/pandas/pandas.html.
The 1st example starts with the following 2 lines: import pandas as pd from pythia_datasets import DATASETS
But I cannot find the pythia_datasets module:
import pandas as pd
from pythia_datasets import DATASETS Traceback (most recent call last):
Cell In[3], line 1 from pythia_datasets import DATASETS
ModuleNotFoundError: No module named 'pythia_datasets'
The package should be available: (pythia-book-dev) ejlevine@callisto:~$ conda list pythia
And I can see the pythia_datasets directory in my ~/miniconda3/envs/pythia-book-dev/lib/python3.10/site-packages/pythia_datasets directory, with top-level files dated Sep 22 2021.
Can someone please help me fix this?
Thanks,
Eric Levine