Any usage of poetry after installation: No module named 'tomli'
MarcoMeter opened this issue · comments
Problem Description
After installing the dependencies via poetry inside a conda environment, any use of poetry results in ModuleNotFoundError: No module named 'tomli'
.
Checklist
- I have installed dependencies via
poetry install
(see CleanRL's installation guideline. - I have checked that there is no similar issue in the repo.
- I have checked the documentation site and found not relevant information in GitHub issues.
Current Behavior
After creating a fresh conda environment, I run pip install poetry
followed by poetry install
. So far no errors are logged and it seems that the installation succeeded. But once poetry is used, like poetry shell
or poetry install -E docs
, the package tomli cannot be found even though its listed as completed during the first run of poetry install
.
D:\Repositories\cleanrl_ppo_trxl>poetry shell
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\cl\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\envs\cl\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\cl\Scripts\poetry.exe\__main__.py", line 4, in <module>
File "C:\ProgramData\Anaconda3\envs\cl\lib\site-packages\poetry\console\application.py", line 19, in <module>
from poetry.__version__ import __version__
File "C:\ProgramData\Anaconda3\envs\cl\lib\site-packages\poetry\__version__.py", line 5, in <module>
from poetry.utils._compat import metadata
File "C:\ProgramData\Anaconda3\envs\cl\lib\site-packages\poetry\utils\_compat.py", line 13, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli
Expected Behavior
Open poetry shell or run any documented CleanRL process.
Possible Solution
- clone ...
cd cleanrl
conda create -n cl python=3.10 --yes
conda activate cl
pip install poetry
poetry shell
poetry install
poetry run python cleanrl/ppo.py
Steps to Reproduce
- clone ...
cd cleanrl
conda create -n cl python=3.10 --yes
conda activate cl
pip install poetry
poetry install
poetry shell
or any other poetry command
What I tried
- tried Python 3.9 and 3.10
- fresh conda environment
- poetry run pip install tomli
- Any poetry call causes the ModuleNotFoundError
- pip install tomli
- Requirement already satisfied
Hi @vwxyzjn
I have to reopen this issue as I'm facing this again while attempting to execute the benchmarks for pr459 via ./benchmark/ppo_trxl.sh
on my institution's slurm cluster.
Do you have any idea on how to debug this?
Is it eligible to omit poetry?
I somehow managed to make it work on my local machine, which was sufficient to generate the pytoml and lock files.
ppo_trxl.sh
# export WANDB_ENTITY=openrlbenchmark
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/mmarplei/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/mmarplei/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/mmarplei/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/mmarplei/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
conda activate py310
poetry install
OMP_NUM_THREADS=1 poetry run python -m cleanrl_utils.benchmark \
--env-ids MortarMayhem-Grid-v0 MysteryPath-Grid-v0 MysteryPath-v0 \
--command "poetry run python ./cleanrl/ppo_trxl/ppo_trxl.py --track --capture_video" \
--num-seeds 3 \
--workers 9 \
--slurm-template-path benchmark/cleanrl_1gpu.slurm_template
OMP_NUM_THREADS=1 poetry run python -m cleanrl_utils.benchmark \
--env-ids MortarMayhem-v0 SearingSpotlights-v0 \
--command "poetry run python ./cleanrl/ppo_trxl/ppo_trxl.py --track --capture_video --reconstruction_coef 0.1" \
--num-seeds 3 \
--workers 9 \
--slurm-template-path benchmark/cleanrl_1gpu.slurm_template