Can't Import Ogre please help!

Darky

18-11-2005 21:29:08

Hi everyone,
I am new to this forum and I am in need of serious help (so please if you now what the wrong is post it here or pm me)
now to the error:
I am trying to import ogre the code looks like this:


from pyogre import ogre

and end up with this error:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
from pyogre import ogre
File "C:\Python24\Lib\site-packages\pyogre\ogre.py", line 4, in -toplevel-
import _ogre
ImportError: DLL load failed: Det går inte att hitta den angivna modulen*.

I have tryed the debugger and also tryed searching the wiki. thx for any reply given
*this litle text is in swedish. what it says is that it "can't find module in assigned path"

totalknowledge

18-11-2005 22:07:07

You can use any of the following but the way you have it is incorrect

import pyogre.ogre

from pyogre.ogre import *

import pyogre.ogre as ogre

hope that helps


[forgot the .ogre :oops: ]

Clay

18-11-2005 22:57:07

He has it correct.
from pyogre import ogre
Is what I use.

Did you download the exe from the project page or did you build this yourself?

Edit: I also assume this is for windows right?

Darky

19-11-2005 20:06:43

yes your assumption is right I am using windows.
and I downloaded the .exe.
the exe was downloaded from:
https://developer.berlios.de/projects/pyogre/
and the tutorial I am currently reading is:
http://www.ogre3d.org/wiki/index.php/Py ... Tutorial_1

hope this helps...

edit: I think I'll try reinstalling and se what happens.
oh and I edited the first post

Clay

19-11-2005 22:16:07

That's very strange.

Check in your C:\Python24\Lib\site-packages\pyogre folder, is the _ogre.pyd file there?

It should also contain a lot of dlls.

totalknowledge

21-11-2005 15:05:07

Which version of Python are you using?

Darky

24-11-2005 18:21:03

I'm using python 2.4.2 (the newest I think, right?)
I checked the path C:\Python24\Lib\site-packages\pyogre.
I did find _ogre.pyd
allot of dlls (exactly 20 of them that I could se).
I have taken a screenshot I'll just give a link:
[/url]
(yes I know its not a perfect screenshot but at least should give you a better idea of the problem.)
A list of EVERYTHING I found in C:\Python24\Lib\site-packages\pyogre:
[list]_init_ (python file). _init_ (compiled python file). _init_ (another compiled python file). _cegui.pyd . _ogre.pyd . cegui.py . cegui (compiled python file). cegui (compiled python file). CEGUIBase.dll. CEGUITaharezLook.dll. CEGUIWindowsLook.dll. cg.dll. devil.dll. ilu.dll . ilut.dll. ogre.py . ogre (compiled python file). ogre (compiled python file). OgreGUIRenderer.dll. OgreMain.dll.OgrePlatform.dll.
OpenGLGUIRenderer.dll. Plugin_BSPSceneManager.dll. Plugin_CgProgramManager.dll. Plugin_OctreeSceneManager.dll. Plugin_ParticleFX.dll . plugins.cfg. RenderSystem_Direct3D7.dll. RenderSystem_Direct3D9.dll. RenderSystem_GL.dll. xerces-c_2_7.dll. zlib1.dll[/list:u]
any new ideas?
EDIT: I'll try reinstalling ALL of the programs (including python 2.4.2)
edit: what is the newest Pyogre version??? thx in for hand for replays.

Clay

25-11-2005 00:33:41

1.0.5-1 is the most recent version.

This has to be the strangest bug I've ever seen. Run a command prompt (Start->Run, type "cmd").

Type this:
cd \Python24\Lib\site-packages\pyogre
c:\Python24\python.exe


In python, run this command:
import ogre

That should import fine, but I'm still not sure why this fails.

---

Also, did you try building PyOgre from source? Open your Control Panel, go to "System", click the "Advanced" tab, click the "Environment Variables".

Make sure there is not a "PYTHONPATH" variable in the "User variables" and the "System Variables". If the PYTHONPATH variable is set then it can wreck havok with python's import.

totalknowledge

25-11-2005 00:34:29

Try checking everything that would involve paths. Especially the .cfg files. The plugin.cfg has to be able to find the other dll's to load.

Darky

25-11-2005 19:25:38

Ok I'll try building from source and all the other tips until the dam machine makes it work.
Is there any source tutorial thats good out there??
until someone replays I'll try building it with any tutorial I find (that's if I find a source tutorial)

totalknowledge

28-11-2005 14:35:33

The instructions for building pyogre yourself are located here:

http://www.ogre3d.org/wiki/index.php/Py ... gOnWindows

I did a little playing around and the problem is when _ogre.pyd tries to load OgreMain.dll. There is a different error message when it can not load the other libraries.

Darky

03-12-2005 14:44:41

Is there any way to go in to the _ogre.pyd and fix the problem?
And I'm currrently building from source although its a little hard
edit:I'm just now downloading the 1.0.6-0 pyogre hope it works

egerlach

03-12-2005 22:11:36

I'm having a similar problem (perhaps the same). This is with all the newest versions of Python (2.4.2), PyGame(1.7.1), Psyco (1.5), and PyOgre (1.0.6-0).

The error message I'm getting is:
Traceback (most recent call last):
File "C:\Python24\pyogre\ogre_demos\LightingDemo.py", line 2, in ?
import pyogre.ogre as ogre
File "C:\Python24\Lib\site-packages\pyogre\ogre.py", line 4, in ?
import _ogre
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.


Just thought I'd add in what I could. Unfortunately I don't have VC++ from which to complile Ogre, so I can't help beyond that :(

Clay

03-12-2005 22:13:51

Sorry this seems to be a problem with missing VC8 dependencies. Try downloading a previous version.

I'm going to have to dig through and figure out what exactly everything depends on to make sure everything will run. Might take a few days to track down the missing dll.

egerlach

03-12-2005 23:23:28

Got it working with 1.0.1. Thanks!

Darky

10-12-2005 18:10:41

good for you egerlach.
I'm gonna try downloading a .dll file I think is missing (I'll report if it works, if it doesn't I'll just wait for an uppdate or something)

Clay

10-12-2005 23:21:57

Ok, try installing 1.0.6-0 and install the vcredist_x86.exe file as well. This (hopefully) should fix the last of your problems.

https://developer.berlios.de/project/showfiles.php?group_id=3464

Darky

11-12-2005 14:04:40

What can I say it works!!!!
I wan't to thank everyone that has either wathched this thread or helped the following are:

Clay, Totalknowledge and egerlach (well egerlach didn't helped that much but whatever :wink: )

Clay I really owe you, without you I would have abandoned Pyogre and I don't know what 3d engine I would have used (probably the suckiest in the world)


HELP: If you have the same problem I have 3 tips:

1. Go here: https://developer.berlios.de/project/sh ... up_id=3464
and download 1.0.6-0 and vcredist_x86.exe. Install and then it should work.
2.(if you are missing dlls and above doesn't work) Go here: http://www.dll-files.com and download all of the missing dll:s
(NOTE: You'll need to know the names of the dll:s)
3. post on the forum like I did :)



Well this thread is from now on useless

Michael

17-12-2005 06:01:36

I got the exact same message as posted at the top. I tried this:

cd \Python24\Lib\site-packages\pyogre
c:\Python24\python.exe

In python, run this command:
import ogre


And got the following error:

python.exe - Unabled ot Locate DLL
The dynamic link library MSVCR80.dll could not be found in the specified path


It looks like this is a Microsoft® C Runtime Library from Visual Studio 2005.

[Edit]
Ok, missed the second page of postings. Now that I've read it I see that this has already been addressed:


Ok, try installing 1.0.6-0 and install the vcredist_x86.exe file as well. This (hopefully) should fix the last of your problems.


The irony! I got this error when I tried to install vcredist_x86.exe:

Microsoft Visual C++ 2005 Redistributable
Error 1723: There is a problem with this Windows Installer package. A DLL required for install to complete could not be run.


I'm running windows 2000, so I'm wondering if that is for XP. Or perhaps my DLLS are just all fubared. Any ideas?

dermont

17-12-2005 06:58:47

It installs OK on Windows98, could the problem be related to this thread?:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=149470&SiteID=1

smope2

16-01-2006 05:02:13

further troubles

I did everything described, but always gopt caught on the redist install.
Severl hair pulling hours later I found out I needed Windows installer MSI 3.1.

Basically, Service pac 2.
If you want it without Service pack two, open Internet Exploder, and go to windows update. Do a custom install. Let it update your Windows Update. It will then AGAIN need to update windows update.
You'll see it insntalling MSI 3.1
Its that or go through the hassles of Windows Genuine Advantage to get the install seperately.

But your problems dont end there.
You'll need the d3dx9_2x.dll (27 most likely)
An instlaler for those can be grabbed here
http://www.shdon.com/view?doc=d3dx

Also, make sure your media directory is in the right place, or Ogre will say it cant open OgreCore.zip
the correct place is right off of pyogre, NOT in ogre_demos as ?was? stated in the pyogre media install readme.

now everythign work.

SuperElectric

26-01-2006 17:50:38

I just compiled pyogre on ubuntu linux (5.10), and got the same error message as the first poster when I try to run any of the demo programs:

$ python beginner_1.py
Traceback (most recent call last):
File "beginner_1.py", line 3, in ?
from pyogre import ogre
File "/usr/lib/python2.4/site-packages/pyogre/ogre.py", line 4, in ?
import _ogre
ImportError: libOgreMain.so.4: cannot open shared object file: No such file or directory


My libOgreMain.so.4 is in /usr/local/lib, so I don't think it's a problem with the library not being in the expected place (right?).

Can somebody recommend something to try to narrow down the problem? I'm using the following versions of the required libraries:
  1. pyogre: svn
    swig: 1.3.27
    ogre: 1.0.6
    cegui: 0.4.1[/list:u]

    -- Matt

SuperElectric

27-01-2006 21:53:54

Clay's earlier post said:Check in your C:\Python24\Lib\site-packages\pyogre folder, is the _ogre.pyd file there?
I tried looking in the corresponding (I think) linux directory /usr/lib/python2.4/site-packages/pyogre, and found the following files, but no _ogre.pyd:
$ ls
cegui.py _cegui.so __init__.pyc ogre.pyc
cegui.pyc __init__.py ogre.py _ogre.so

Does _ogre.so in linux correspond to _ogre.pyd in Windows? If not, why isn't "sudo setup.py install" installing it? Or if so, why can't the demo programs import "_ogre"? I tried putting a softlink to the above directory in /usr/local/lib/python2.4/site-packages/, but that didn't help.

Any help would be greatly appreciated. I'd love to be able to run ogre through python, as can probably be inferred by my incessant installation questions (O_O;)

-- Matt

Kanma

27-01-2006 22:06:19

You're right, on linux _ogre.so is the equivalent of _ogre.pyd on Windows. The problem is that it failed to load Ogre itself (libOgreMain.so.4). On my Windows machine, all the Ogre libraries are in the same folder than pyogre, but I don't know about a typical linux installation to be honest...

dermont

29-01-2006 05:51:49

Your site-packages dir looks fine. Try adding /usr/local/lib to /etc/ld.so.conf and then running ldconfig

I haven't used Ubuntu but AFAIK, ld.so.conf doesn't exist so you may have to create it. The following post has an example Ubuntu conf file:
http://ubuntuforums.org/archive/index.php/t-85398.html

SuperElectric

30-01-2006 03:16:29

Ok, I tried running a demo, and now it seems like it's finding _ogre.so. I get a different error message now; it seems like it couldn't find a particular symbol in _ogre.so.
$ python CameraTrackingDemo.py
Traceback (most recent call last):
File "CameraTrackingDemo.py", line 2, in ?
import pyogre.ogre as ogre
File "/usr/lib/python2.4/site-packages/pyogre/ogre.py", line 4, in ?
import _ogre
ImportError: /usr/local/lib/python2.4/site-packages/pyogre/_ogre.so: undefined symbol: _ZN4Ogre9SingletonI11EventSystemE12ms_SingletonE

Does this mean that it's still not finding the ogre library itself? I created my /etc/ld.so.conf file as follows:
/usr/lib/atlas
/lib/
/usr/lib
/usr/local/lib/
/usr/X11R6/lib/

And of course, I ran sudo ldconfig afterwards.

-- Matt

dermont

30-01-2006 03:38:40

No looks like it's finding _ogre.so.

It looks as if you are using pyogre svn trunk. If so setup.py is not up to date. There's a patch here (you can ignore the OgreMovable Text):
http://developer.berlios.de/patch/download.php?id=796


To manually apply the changes:

Add EventSystem.cxx to setup.py, e.g.

ext_ogre = pyogre_Extension("pyogre._ogre",
["pyogre/ogre/ogre.i",
"pyogre/ogre/VertexBufferProxy.cxx",
"pyogre/ogre/IndexBufferProxy.cxx",
"pyogre/ogre/EventSystem.cxx"],
pkg_config_module='OGRE')


Edit pyogre/ogre/EventSystem.cxx

//EventSystem *Singleton<EventSystem>::ms_Singleton = 0;
template <> EventSystem *Singleton<EventSystem>::ms_Singleton = 0;



Usual procedure python setup.py clean, manually clear out the *_wrap.cxx and *_wrap.h and rebuild.

Alternatively use version pyogre 1.0.6-0.

SuperElectric

30-01-2006 18:51:32

Ok, I'm getting further now. I cd'ed to pyogre/ and tried to run LightingDemo.py, but got an error saying that it couldn't find the dynamic library "RenderSystem_Direct3d9.so":
$ python ../demos/ogre/LightingDemo.py
Creating resource group General
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
Loading library libOgrePlatform.so
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DevIL version: Developer's Image Library (DevIL) 1.6.7 Apr 14 2005
DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
Registering ResourceManager for type HighLevelGpuProgram
Loading library ./RenderSystem_Direct3D9
OgreDynLib.cpp(82): ogre error 9: Could not load dynamic library ./RenderSystem_Direct3D9. System Error: ./RenderSystem_Direct3D9.so: cannot open shared object file: No such file or directory

It should be looking for /usr/local/lib/OGRE/RenderSystem_GL.so instead of RenderSystem_Direct3D9.so, right? What file do I need to edit to get it to do that?

I got the same error when I ran /pyogre/demos/tutorials/beginner_1.py. (To do this I first needed to make a soft link to /pyogre/demos/ogre/SampleFramework.py in /pyogre/demos/tutorials).

-- Matt

dermont

30-01-2006 18:59:41

Hopefully this should help:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=261

SuperElectric

30-01-2006 20:14:25

Your link led me to the plugins.cfg file, which specifies the RenderSystem_GL.so library:
# Define plugin folder
PluginFolder=/usr/local/lib/OGRE

# Define D3D rendering implementation plugin
Plugin=RenderSystem_GL.so
Plugin=Plugin_ParticleFX.so
Plugin=Plugin_BSPSceneManager.so
Plugin=Plugin_OctreeSceneManager.so
Plugin=Plugin_CgProgramManager.so


I tried copying this file to the demos/ogre/ directory, but this by itself didn't work; because the SampleFramework constructor only loads resoucres.cfg, not plugins.cfg. I tried changing SampleFramework._setUpResources from:
def _setUpResources(self):
"""This sets up Ogre's resources, which are required to be in
resources.cfg."""
config = ogre.ConfigFile()
config.loadFromFile('resources.cfg' )
for section, key, path in config.values:
ogre.ResourceGroupManager.getSingleton().addResourceLocation(path, key, section)

...to:
def _setUpResources(self):
"""This sets up Ogre's resources, which are required to be in
resources.cfg."""
config = ogre.ConfigFile()
config.loadFromFile('resources.cfg' )
config.loadFromFile('plugins.cfg')
for section, key, path in config.values:
ogre.ResourceGroupManager.getSingleton().addResourceLocation(path, key, section)

But apparently this wasn't quite the right thing to do. When I tried to run a demo, it stumbled on the line:
PluginFolder=/usr/local/lib/OGRE
... in plugins.cfg (see full output below).

What's the proper way to get SampleFramework.py to load all the information in plugins.cfg? I doubt I can just delete the offending line above, since it specifies the plugin directory.

The full output of running LightingDemo.py is as follows. The error is about 20 lines from the bottom:
pyogre_svn/trunk/demos/ogre$ python LightingDemo.py
Creating resource group General
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
Loading library libOgrePlatform.so
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DevIL version: Developer's Image Library (DevIL) 1.6.7 Apr 14 2005
DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
Registering ResourceManager for type HighLevelGpuProgram
Loading library /usr/local/lib/OGRE/RenderSystem_GL.so
OpenGL Rendering Subsystem created.
Loading library /usr/local/lib/OGRE/Plugin_ParticleFX.so
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Loading library /usr/local/lib/OGRE/Plugin_BSPSceneManager.so
Registering ResourceManager for type BspLevel
Loading library /usr/local/lib/OGRE/Plugin_OctreeSceneManager.so
TerrainSceneManager: Registered a new PageSource for type Heightmap
Loading library /usr/local/lib/OGRE/Plugin_CgProgramManager.so
*-*-* OGRE Initialising
*-*-* Version 1.0.6 (Azathoth)
Creating resource group Bootstrap
Added resource location '../media/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
Added resource location '../media' of type 'FileSystem' to resource group 'General'
Added resource location '../media/fonts' of type 'FileSystem' to resource group 'General'
Added resource location '../media/materials/programs' of type 'FileSystem' to resource group 'General'
Added resource location '../media/materials/scripts' of type 'FileSystem' to resource group 'General'
Added resource location '../media/materials/textures' of type 'FileSystem' to resource group 'General'
Added resource location '../media/models' of type 'FileSystem' to resource group 'General'
Added resource location '../media/overlays' of type 'FileSystem' to resource group 'General'
Added resource location '../media/particle' of type 'FileSystem' to resource group 'General'
Added resource location '../media/packs/cubemap.zip' of type 'Zip' to resource group 'General'
Added resource location '../media/packs/cubemapsJS.zip' of type 'Zip' to resource group 'General'
Added resource location '../media/packs/dragon.zip' of type 'Zip' to resource group 'General'
Added resource location '../media/packs/fresneldemo.zip' of type 'Zip' to resource group 'General'
Added resource location '../media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
Added resource location '../media/packs/skybox.zip' of type 'Zip' to resource group 'General'
Creating resource group
OgreArchiveManager.cpp(62): ogre error 7: Cannot find an archive factory to deal with archive of type PluginFolder
*-*-* OGRE Shutdown
Unregistering ResourceManager for type Font
Unregistering ResourceManager for type Skeleton
Unregistering ResourceManager for type Mesh
Unregistering ResourceManager for type HighLevelGpuProgram
Unloading library /usr/local/lib/OGRE/Plugin_CgProgramManager.so
Unloading library /usr/local/lib/OGRE/Plugin_OctreeSceneManager.so
Unregistering ResourceManager for type BspLevel
Unloading library /usr/local/lib/OGRE/Plugin_BSPSceneManager.so
Unloading library /usr/local/lib/OGRE/Plugin_ParticleFX.so
******************************
*** Stopping SDL Subsystem ***
******************************
Unloading library /usr/local/lib/OGRE/RenderSystem_GL.so
Unregistering ResourceManager for type Material
Unloading library libOgrePlatform.so

Thanks again for the help so far,
-- Matt

dermont

30-01-2006 21:40:10

Please post specs for your graphics card and drivers you are using. SDL / ATI won't cut it as far as I know.

I'm using nvidia / GLX platform manager with ogre (nstead of SDL) i.e compiling ogre with:
./configure --with-platform=GLX

Anyone that has SDL or ATI working please feel free to interject.

dermont

30-01-2006 22:28:21

Ok I've compiled ogre with SDL ( gcc 3.4.x) , it runs but segfaults on exit.

SuperElectric wrote:

I tried copying this file to the demos/ogre/ directory, but this by itself didn't work; because the SampleFramework constructor only loads resoucres.cfg, not plugins.cfg. I tried changing SampleFramework._setUpResources from:

Don't quite understand what you are saying, plugins.cfg is loaded from _setUp.

def _setUp(self):
"""This sets up the ogre application, and returns false if the user
hits "cancel" in the dialog box."""
self.root = ogre.Root(ogre.getPluginPath())


What was the original error message?

SuperElectric

30-01-2006 22:46:35

First, to answer dermont's question, my graphics card and driver are:
  1. Graphics card: nvidia geforce go 440
    Driver: nvidia, glx version 1.3.[/list:u]
    Second: I rebuilt ogre using "./configure --with-platform=GLX", and now the demos run! Thanks to dermont, kanma, and anybody else I might've forgotten for the consistent help! I'll post a summary of all this to the "how to build pyogre on linux" wiki page.

    -- Matt

SuperElectric

30-01-2006 23:20:53

Don't quite understand what you are saying, plugins.cfg is loaded from _setUp.

def _setUp(self):
"""This sets up the ogre application, and returns false if the user
hits "cancel" in the dialog box."""
self.root = ogre.Root(ogre.getPluginPath())

Er, nevermind. I had just searched for the string "plugins.cfg" in SampleFramework.py, and when I didn't find any, I wrongly concluded that it wasn't getting read. I see now that it's explicitly referenced in the ogre.Root constructor in /usr/lib/python2.4/site-packages/pyogre/ogre.py, which the above code calls.

rasronin

01-02-2006 02:46:17

Here is the error I was getting:

Traceback (most recent call last):
File "C:\Python24\pyogre\ogre_demos\EnvMapDemo.py", line 2, in ?
import pyogre.ogre as ogre
File "C:\Python24\Lib\site-packages\pyogre\ogre.py", line 4, in ?
import _ogre
ImportError:


Ok, im a newb myself in every sense of the word, and was trying to get this working on my computer. I got the same error messages the other guys were getting, and was ready to say to hell with pyogre :(

BUT....

I read one of the post saying to try an earlier version and that didn't fix it.

So I played around with the folder structure a bit, I changed the name of the demo folder from c:\Python24\pyoger\oger_demos to C:\Python24\pyogre\demos and voila, it works.

Warning< I make no claim to being a 'hacker' in any sense, but I fixed my own problem, so if this doesn't fix it for you, don't be mad at me, enjoy ur problem.

Oh, and fellow newbs, put the media folder in the C:\Python24\pyogre\,
that may help a lil bit too

leau2001

14-02-2006 13:13:07

May be try to install

this file : http://download.berlios.de/pyogre/vcredist_x86.exe

from http://developer.berlios.de/project/showfiles.php?group_id=3464&release_id=8222

it's a c++ using module

Anonymous

01-10-2006 13:25:53

LOL
------------------------------