Forums » Software Installation »
Problem finding leginon/icon path on Windows
Added by Anchi Cheng about 11 years ago
This is a problem at NIH where when leginon is started, it complains that icon images in leginon/icon can not be found. This appears to be a problem with python finding path.
Replies (4)
RE: Problem finding leginon/icon path on Windows - Added by Shunming Fang about 11 years ago
leginon absolute path in Windows XP is C:\python25\lib\site-packages\leginon and also I set PYTHONPATH in windows XP: c:\python25;c:\python25\lib\site-packages;
c:\python25\lib\site-packages\leginon; c:\python25\lib\site-packages\pyami;c:\python25\lib\site-packages\pyscopy;c:\python25\lib\site-packagesleginon\icons
in CMD: cd c:\python25\lib\site-packages\leginon\icons; C:\python25\python.exe;
import os
import icons; from icons import getPath;
filename=getPath('info.png')
os.path.abspath(filename)
the result is 'C:\\python25\\lib\\site-packages\\leginon\\icons\\leginon\\icons\\info.png'
It is wrong, because it should be C:\\python25\\lib\\site-packages\\leginon\\icons\\info.png'
RE: Problem finding leginon/icon path on Windows - Added by Anchi Cheng about 11 years ago
Shunming,
I can't reproduce it here, but spotted a few things you should correct
PYTHONPATH you set:
Remove c:\python25 and c:\python25\lib\site-packages (site-packages should be automatically included so you don't have to do so.)
Remove c:\python25\lib\site-packages\pyami;c:\python25\lib\site-packages\pyscope (These can be found under site-packages, so it should be fine).
Remove c:\python25\lib\site-packages\leginon\icons.
In addition, check under C:\python25\site-packages\leginon\icons to see if there is a folder called leginon in there. It is possible that it was acciddentally installed or copied there.
After you've checked these, run python command line to check where things are.
import sys sys.path
This gives you the full list of PYTHONPATH
import icons icons
This gives you where the module is loaded from and should work wherever you launched the python commandlines.
It should say 'c:\python25\lib\site-packages\leginon\icons\__init__.pyc'
Repeat this with the syntex used in leignon code:
from leginon import icons icons
The result should be identical.
Last, do a file search in your system to see if there are more than one leginon\icons resulting from soft link or equivalent.
Remove extras.
If problem is not solved by now, post the result of each command here.
RE: Problem finding leginon/icon path on Windows - Added by Anchi Cheng about 11 years ago
Just notice something.
The test script you posted earlier would not have worked, at least based on what I know.
getPath is not a module in icons, but a function. Therefore, you could not have import getPath from icons.
Try these instead since icons is loaded from leginon/gui/wx. It is the exact call when you start leginon in myami-2.2 or myami-2.2-redux.
These include the results from our Windows PC with python 2.5.4
cd c:\python25\lib\site-packages\leginon\gui\wx c:\python25\python.exe >>> import sys >>> sys.path ['','C:\\WINDOWS\\system32\\python25.zip','c:\\python25\\DLLs', 'c:\\python25\lib', 'c:\\python25\\lib\\site-packages', ....] >>>import leginon.icons >>>leginon.icons <module 'leginon.icons' from 'c:\python25\lib\site-packages\leginon\icons\__init__.pyc'> >>>icons.getPath('info.png') 'C:\\Python25\\lib\\site-packages\\leginon\\icons\\info.png'
If you intend to redo the installation, try install myami-3.0, which uses python 2.7. We are still working on the documentation but you can follow mostly what is for trunk version.
RE: Problem finding leginon/icon path on Windows - Added by Anchi Cheng about 11 years ago
Another idea I have is not to use any python site-packages installation for myami.
You should have a download directory where you did svn checkout.
If you have called it Leginon, maybe rename it to myami. I am concerned that the extra leginon you found in your getPath is related to the naming. All our subpackages should be under that. Therefore, you should have /YourDownLoad/myami/leginon, /YourDonwLoad/myami/pyscope etc.
Change your PYTHONPATH environment variable to have /YourDownLoad/myami as the first thing and maybe the only thing in the path list you assign.
This way, it will not try to use any of your installation in site-packages that might have screwed up because python will find the module in /YourDownload/myami first.