numpy_sample.py : can't find "Ogre" module Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
reb_cabin
Gnoblar
Posts: 12
Joined: Thu Jul 05, 2018 4:19 pm

numpy_sample.py : can't find "Ogre" module

Post by reb_cabin » Thu Jul 05, 2018 5:26 pm

Ogre Version: :1.11.1:
Operating System: :Pop! OS (Ubuntu derivative):
Render System: :OpenGL 3:

Preconditions: newbie user; Fresh installation; successful build (`make install`); cython is installed; build log shows Python bindings are built; libs in `/usr/local/bin/`; `SampleBrowser` app works; everything seems to be nominally ok.

What I want to do: `python ./Samples/Python/numpy_sample.py`

Python version:

Code: Select all

Python 3.6.5 :: Anaconda, Inc.
I have dozens of Python projects that work well, so I am confident that my Python installation is correct.

What I tried: `LD_LIBRARY_PATH="/usr/local/lib:/home/rebcabin/Documents/GitHub/ogre-1.11.1/build/Dependencies/lib" python ./Samples/Python/numpy_sample.py`

I also tried a bunch of other `LD_LIBRARY_PATH`s and `PYTHONPATH` permutations; too many to write down or remember. The result is always the same.

What I read trying (and failing) to find answer: https://ogrecave.github.io/ogre/api/lat ... numpy.html

Many wiki pages about deprecated `PyOgre` and `Python-Ogre`; hints about `Xalafu` that I did not chase; about an hour's worth of googling.

What happened: no matter what I do, I always get this

Code: Select all

Traceback (most recent call last):
  File "./Samples/Python/numpy_sample.py", line 1, in <module>
    import Ogre
ModuleNotFoundError: No module named 'Ogre'
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 572
Joined: Sun Mar 30, 2014 2:51 pm
x 83
Contact:

Re: numpy_sample.py : can't find "Ogre" module

Post by paroj » Thu Jul 05, 2018 11:01 pm

are the python modules there?

Code: Select all

> ls /usr/local/lib/python3.6/dist-packages/
OgreBites.py   OgreNumpy.py    _OgreOverlay.so  OgreRTShader.py   _Ogre.so
_OgreBites.so  OgreOverlay.py  Ogre.py          _OgreRTShader.so
1 x

reb_cabin
Gnoblar
Posts: 12
Joined: Thu Jul 05, 2018 4:19 pm

Re: numpy_sample.py : can't find "Ogre" module

Post by reb_cabin » Fri Jul 06, 2018 2:43 am

Aha! Those files don't exist, but I don't know why not.

Here are the results of searching my entire file system for a couple of those files (`find` doesn't return anything, so there aren't any results):

Code: Select all

$ find / -name Ogre.py 2> /dev/null
$ find / -name _Ogre.so 2> /dev/null
But my cmake config says it's going to build the Python components. It obviously does not build the two named above. So again I'm blocked not knowing how to acquire the needed files.

Code: Select all

----------------------------------------------------------------------------
  FEATURE SUMMARY
----------------------------------------------------------------------------

Building components:
  + Bites
  + HLMS [BETA]
  + MeshLodGenerator
  + Overlay
  + Paging
  + Property
  + Python [BETA]
  + Java/ JNI [BETA]
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
  + Terrain
  + Volume
Building plugins:
  + BSP scene manager
  + Cg program manager
  + Octree scene manager
  + STBI codec (generic)
  + Portal connected zone scene manager
  + Particle FX
Building rendersystems:
  + OpenGL
  + OpenGL 3+
Building executables:
  + Samples
  + Tools
Building core features:
  + Mesh Lod
  + DDS image codec (.dds)
  + ETC image codec (.pkm, .ktx) 
  + ZIP archives

Build type:                      shared
Thread safety:                   none
ResourceManager behaviour:       strict
Use double precision:            disabled
Nodes inherit transform:         disabled
Assert mode:                     release exceptions
0 x

reb_cabin
Gnoblar
Posts: 12
Joined: Thu Jul 05, 2018 4:19 pm

Re: numpy_sample.py : can't find "Ogre" module

Post by reb_cabin » Fri Jul 06, 2018 3:07 am

Below is a snapshot from cmake-gui showing the PYTHON option checked.

After running this cmake and the corresponding make (with no errors), the files Ogre.py and _Ogre.so are still nowhere to be found on my system:

Code: Select all

$ find / -name Ogre.py 2> /dev/null
$ find / -name _Ogre.so 2> /dev/null
Image
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 572
Joined: Sun Mar 30, 2014 2:51 pm
x 83
Contact:

Re: numpy_sample.py : can't find "Ogre" module

Post by paroj » Fri Jul 06, 2018 11:02 am

reb_cabin wrote:
Fri Jul 06, 2018 2:43 am
But my cmake config says it's going to build the Python components. It obviously does not build the two named above. So again I'm blocked not knowing how to acquire the needed files.
currently this output merely means that the component is enabled in CMake. Can you attach the full cmake output? Specifically look out whether SWIG was found.
1 x

reb_cabin
Gnoblar
Posts: 12
Joined: Thu Jul 05, 2018 4:19 pm

Re: numpy_sample.py : can't find "Ogre" module

Post by reb_cabin » Fri Jul 06, 2018 1:26 pm

Brilliant! That was it. It was a fresh machine and I had neglected to install SWIG beforehand, etc. etc. etc.

in the build directory

Code: Select all

$ sudo apt install swig
$ cmake ..
$ make -j7
$ LD_LIBRARY_PATH="/home/rebcabin/Documents/GitHub/ogre-1.11.1/build/Dependencies/lib:/usr/local/lib/python3.6/dist-packages/" PYTHONPATH="/usr/local/lib/python3.6/dist-packages/" python ../Samples/Python/numpy_sample.py
all is solved, thanks very much
0 x

Post Reply