h2r / pomdp-py

A framework to build and solve POMDP problems. Documentation: https://h2r.github.io/pomdp-py/
MIT License
216 stars 50 forks source link

Can't find module named 'pomdp_py.algorithms.po_uct' #24

Closed JellaGit closed 11 months ago

JellaGit commented 1 year ago

Hi all & happy new year,

I tried installing this version(1.3.2) of the pomdp_py

I followed the instructions on how to install pomdp_py via https://h2r.github.io/pomdp-py/html/installation.html . So I did the following in my Anaconda prompt (Anaconda3) :

  1. Install Cython: pip install Cython
  2. Download the packages from this GitHub page : Source code (zip) Apr 3, 2022 and Source code (tar.gz) Apr 3, 2022
  3. pip install -e .

This all seemed to work.

Then I tried to test things out: python -m pomdp_py -r tiger python -m pomdp_py -r rocksample python -m pomdp_py -r mos

But for all, the error my Anaconda Prompt gives is : ModuleNotFoundError: No module named 'pomdp_py.algorithms.po_uct'

I also tried it directly from Spyder(5.3.3), but got the same result. \pomdp_py\utils\debugging.py", line 91, in from pomdp_py.algorithms.po_uct import TreeNode, QNode, VNode, RootVNode ModuleNotFoundError: No module named 'pomdp_py.algorithms.po_uct'

Does anyone know where I go wrong or how to fix it?

Sorry if it is foolish, I never download packages.

zkytony commented 1 year ago

Thanks for posting! It is great that you tried and shared your experience.

I can't immediately tell what the cause is in your case, but the symptom is the po_uct's Cython files don't seem to be found (e.g. pomdp_py.algorithms.po_uct points to pomdp_py/algorithms/po_uct.pyx).

After completing step 3, can you just try

import pomdp_py

in a Python shell?

JellaGit commented 1 year ago

Running only import pomdp_py does not give errors.

zkytony commented 1 year ago

What about the following

from pomdp_py import POUCT

Also, do you see the presence of .pyx and .pxd files in your decompressed folder of pomdp-py?

JellaGit commented 1 year ago

Still works

zkytony commented 1 year ago

Interesting, what about doing the following:

>>> import pomdp_py
>>> pomdp_py.POUCT
<class 'pomdp_py.algorithms.po_uct.POUCT'>
>>> pomdp_py.POMCP
<class 'pomdp_py.algorithms.pomcp.POMCP'>
JellaGit commented 1 year ago

Hmm, I first tried it in Jupyter notebook, that didn't give an error.


Now I tried to run it in a python shell.

input: import pomdp_py

output: Traceback (most recent call last):

File "C:\Users\Jelge\AppData\Local\Temp\ipykernel_12356\1801930298.py", line 1, in import pomdp_py

File "C:\Users\Jelge\pomdp_py__init__.py", line 1, in import pomdp_py.utils as util

File "C:\Users\Jelge\pomdp_py\utils__init__.py", line 11, in from pomdp_py.utils.debugging import TreeDebugger

File "C:\Users\Jelge\pomdp_py\utils\debugging.py", line 91, in from pomdp_py.algorithms.po_uct import TreeNode, QNode, VNode, RootVNode

ModuleNotFoundError: No module named 'pomdp_py.algorithms.po_uct'


Your other question: Yes I see the presence of .pyx and .pxd files in the subfolders of the pomdp_py folder

zkytony commented 1 year ago

Have you checked out the installation guide on Windows? https://github.com/h2r/pomdp-py/wiki/Installing-pomdp%E2%80%90py-on-Windows

I don't know why it works in Jupyter notebook but not in Python shell... It smells like a Windows-specific configuration problem. I would check whether the paths to Python modules are the same in Jupyter notebook vs. the shell. For example, you can check out https://stackoverflow.com/questions/2927993/where-are-the-python-modules-stored

zkytony commented 11 months ago

Closing this now. Feel free to reopen if this is still an issue.