Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any usage of poetry after installation: No module named 'tomli' #455

Open
3 tasks done
MarcoMeter opened this issue Apr 12, 2024 · 1 comment
Open
3 tasks done

Any usage of poetry after installation: No module named 'tomli' #455

MarcoMeter opened this issue Apr 12, 2024 · 1 comment

Comments

@MarcoMeter
Copy link

MarcoMeter commented Apr 12, 2024

Problem Description

After installing the dependencies via poetry inside a conda environment, any use of poetry results in ModuleNotFoundError: No module named 'tomli'.

Checklist

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

  1. clone ...
  2. cd cleanrl
  3. conda create -n cl python=3.10 --yes
  4. conda activate cl
  5. pip install poetry
  6. poetry shell
  7. poetry install
  8. poetry run python cleanrl/ppo.py

Steps to Reproduce

  1. clone ...
  2. cd cleanrl
  3. conda create -n cl python=3.10 --yes
  4. conda activate cl
  5. pip install poetry
  6. poetry install
  7. 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
@MarcoMeter
Copy link
Author

MarcoMeter commented Apr 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant