Re: no module named error
Joe schrieb: Your installation process is botched (no idea why, you don't show us setup.py or anything else I asked for). Sorry, but I do know how it's currently installed is exactly the way I need it to be installed. It is? It wasn't working until you fiddled with sys.path - which you needed help to find out. How's that exactly the way it is needed? All that is missing is what I've asked you now several times before: _moda.so is *NOT* alongside moda.py inside your python's site-packages directory. Copy it in there, and the import will work *without* any sys.path-hackery. Yeah, that's something I don't want to do. But you've given me enough info to help me understand what's going on and how to fix it. Thanks. So it's ok that the installation copies moda.py, but not that it copies _moda.so to the same destination? Looks all very strange to me. But then - it's your system. Glad it works for you. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into account, and even if it did - _moda.la is a simple archive-file, not a shared library. It can't be dynamically loaded. Something in your build-process is not working. So how should my stuff find these libs? Here's what I've recently learned ... So if I have the dir path of my c libs inside my exported LD_LIBRARY_PATH (which includes the following files), along w/ the dir to the *.la file ... _moda.a _moda.la - ../_moda.la _moda.lai _moda.so - _moda.so.2.0.1 _moda.so.2 - _moda.so.2.0.1 _moda.so.2.0.1 _moda.so.2.0.1T _moda_la-moda_wrap.o I get the 'ImportError: No module named _moda' error as in previous post. But as I think your saying above, this should not work because LD_LIBRARY_PATH doesn't get used. I was at the python command line '' and I did the following command. import sys sys.path.append('/home/me/my/c/libs/path/.libs') # this is the path to the above listed files, and then when I did ... import moda Everything worked just fine. But I'm not quite sure how to fix it in my script or env. -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
On Thu, Dec 10, 2009 at 9:56 AM, Joe invalid.e...@at.address wrote: No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into account, and even if it did - _moda.la is a simple archive-file, not a shared library. It can't be dynamically loaded. Something in your build-process is not working. So how should my stuff find these libs? Here's what I've recently learned ... So if I have the dir path of my c libs inside my exported LD_LIBRARY_PATH (which includes the following files), along w/ the dir to the *.la file ... _moda.a _moda.la - ../_moda.la _moda.lai _moda.so - _moda.so.2.0.1 _moda.so.2 - _moda.so.2.0.1 _moda.so.2.0.1 _moda.so.2.0.1T _moda_la-moda_wrap.o I get the 'ImportError: No module named _moda' error as in previous post. But as I think your saying above, this should not work because LD_LIBRARY_PATH doesn't get used. I was at the python command line '' and I did the following command. import sys sys.path.append('/home/me/my/c/libs/path/.libs') # this is the path to the above listed files, and then when I did ... import moda Everything worked just fine. But I'm not quite sure how to fix it in my script or env. -- http://mail.python.org/mailman/listinfo/python-list http://docs.python.org/library/sys.html sys.path A list of strings that specifies the search path for modules. Initialized from the environment variable PYTHONPATH, plus an installation-dependent default. As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the interpreter is invoked interactively or if the script is read from standard input), path[0] is the empty string, which directs Python to search modules in the current directory first. Notice that the script directory is inserted before the entries inserted as a result of PYTHONPATH. A program is free to modify this list for its own purposes. Changed in version 2.3: Unicode strings are no longer ignored. Python uses the PYTHONPATH variable to find modules/libraries, not LD_LIBRARY_PATH. -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Joe wrote: No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into account, and even if it did - _moda.la is a simple archive-file, not a shared library. It can't be dynamically loaded. Something in your build-process is not working. So how should my stuff find these libs? Here's what I've recently learned ... So if I have the dir path of my c libs inside my exported LD_LIBRARY_PATH (which includes the following files), along w/ the dir to the *.la file ... _moda.a _moda.la - ../_moda.la _moda.lai _moda.so - _moda.so.2.0.1 _moda.so.2 - _moda.so.2.0.1 _moda.so.2.0.1 _moda.so.2.0.1T _moda_la-moda_wrap.o I get the 'ImportError: No module named _moda' error as in previous post. But as I think your saying above, this should not work because LD_LIBRARY_PATH doesn't get used. I was at the python command line '' and I did the following command. import sys sys.path.append('/home/me/my/c/libs/path/.libs') # this is the path to the above listed files, and then when I did ... import moda Everything worked just fine. But I'm not quite sure how to fix it in my script or env. Your installation process is botched (no idea why, you don't show us setup.py or anything else I asked for). All that is missing is what I've asked you now several times before: _moda.so is *NOT* alongside moda.py inside your python's site-packages directory. Copy it in there, and the import will work *without* any sys.path-hackery. Of course you shouldn't do this by hand every time you need to, but instead fix the whole package do to this when python setup.py install is invoked. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Your installation process is botched (no idea why, you don't show us setup.py or anything else I asked for). Sorry, but I do know how it's currently installed is exactly the way I need it to be installed. All that is missing is what I've asked you now several times before: _moda.so is *NOT* alongside moda.py inside your python's site-packages directory. Copy it in there, and the import will work *without* any sys.path-hackery. Yeah, that's something I don't want to do. But you've given me enough info to help me understand what's going on and how to fix it. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
no module named error
I am trying to write/run a python script which imports from another script which is located in my /usr/lib64/python2.6/site-packages/ dir, but getting the following error. $ python ./mytest.py Traceback (most recent call last): File ./mytest.py, line 45, in module from moda import * File /usr/lib64/python2.6/site-packages/moda.py, line 7, in module import _moda ImportError: No module named _moda The script moda.py exists. My script is: #!/usr/bin/python import sys from moda import * def main(args = sys.argv[1:]): print 'test' if __name__ == '__main__' : main() Any idea what I'm doing wrong? -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Joe wrote: I am trying to write/run a python script which imports from another script which is located in my /usr/lib64/python2.6/site-packages/ dir, but getting the following error. $ python ./mytest.py Traceback (most recent call last): File ./mytest.py, line 45, in module from moda import * File /usr/lib64/python2.6/site-packages/moda.py, line 7, in module import _moda ImportError: No module named _moda The script moda.py exists. My script is: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run 64-bit. I'm on gentoo. I'm not sure it's installed correctly, but it did come w/ a setup.py, and I ran 'setup.py install' and it seemed to have installed correctly. $ sudo python ./setup.py install running install running build running build_py running install_lib running install_egg_info Removing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info Writing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run 64-bit. I'm on gentoo. I'm not sure it's installed correctly, but it did come w/ a setup.py, and I ran 'setup.py install' and it seemed to have installed correctly. $ sudo python ./setup.py install running install running build running build_py running install_lib running install_egg_info Removing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info Writing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info You didn't answer my question. Did it install the _moda.* file the moda.py is searching for? Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Diez B. Roggisch wrote: Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run 64-bit. I'm on gentoo. I'm not sure it's installed correctly, but it did come w/ a setup.py, and I ran 'setup.py install' and it seemed to have installed correctly. $ sudo python ./setup.py install running install running build running build_py running install_lib running install_egg_info Removing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info Writing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info You didn't answer my question. Did it install the _moda.* file the moda.py is searching for? Diez Yeah, that's what I meant when I said the file exists above. There's a moda.py in /usr/lib64/python2.6/site-packages/moda.py. -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Joe wrote: Diez B. Roggisch wrote: Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run 64-bit. I'm on gentoo. I'm not sure it's installed correctly, but it did come w/ a setup.py, and I ran 'setup.py install' and it seemed to have installed correctly. $ sudo python ./setup.py install running install running build running build_py running install_lib running install_egg_info Removing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info Writing /usr/lib64/python2.6/site-packages/moda-2.1-py2.6.egg-info You didn't answer my question. Did it install the _moda.* file the moda.py is searching for? Diez Yeah, that's what I meant when I said the file exists above. There's a moda.py in /usr/lib64/python2.6/site-packages/moda.py. Please, read my post *carefully*. moda.py imports a file _moda.* (most probably _moda.so), which seems *not* to be there. Please verify that it exists and has the proper architecture. This is your output: File /usr/lib64/python2.6/site-packages/moda.py, line 7, in module import _moda ImportError: No module named _moda ^ _moda, *not* moda. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Please verify that it exists and has the proper architecture. Ah, ok, I thought those were one in the same. But I do have that file in another directory elsewhere and I have that directory in my LD_LIBRARY_PATH var. Shouldn't that be enough to do it? -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Just to clarify, I have _moda.la sitting in another directory which is included in my LD_LIBRARY_PATH. And it is built for the 64bit arch. -- http://mail.python.org/mailman/listinfo/python-list
Re: no module named error
Joe wrote: Just to clarify, I have _moda.la sitting in another directory which is included in my LD_LIBRARY_PATH. And it is built for the 64bit arch. No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into account, and even if it did - _moda.la is a simple archive-file, not a shared library. It can't be dynamically loaded. Something in your build-process is not working. I suggest you - clean out the source package from everything in there except the original distribution - maybe simply removing unpacking is the best idea. - build the package again, and post the *full* output. This might give us a clue. Alternatively, if it's possible to share the module, do that. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: import _sqlite3 no module named error
In article 77e831100906040708l1a8bf638n19bbff05607b3...@mail.gmail.com, Vincent Davis vinc...@vincentdavis.net wrote: I volunteered to help Marijo Mihelčić who was looking for someone with a mac the help him build a mac binary using py2app for his simpletasktimer http://code.google.com/p/simpletasktimer/wiki/Installation when I try to run his app I get the no module named _sqlite3 , I am not sure what this is caused by as it looks to me like sqlite3 is trying to import it. Any idea how to fix this? Other than the obvious of getting _sqlite3 somehow, or maby it is that simple. here is what i get [...] /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/s qlite3/dbapi2.py, line 27, in module from _sqlite3 import * ImportError: No module named _sqlite3 logout From the path names, it appears you are using the MacPorts python2.5. Try: sudo port install py25-sqlite3 which will bring along sqlite3 if not already installed. It should be that simple. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: import _sqlite3 no module named error
when I try to run his app I get the no module named _sqlite3 , I am not sure what this is caused by as it looks to me like sqlite3 is trying to import it. Any idea how to fix this? Other than the obvious of getting _sqlite3 somehow, or maby it is that simple /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/s qlite3/dbapi2.py, line 27, in module from _sqlite3 import * ImportError: No module named _sqlite3 logout From the path names, it appears you are using the MacPorts python2.5. Try: sudo port install py25-sqlite3 which will bring along sqlite3 if not already installed. Yes I am using macports I think sqlite is installed? here is what I get when I run sudo port install py25-sqlite3 vincent-daviss-macbook-pro-2:~ vmd$ sudo port install py25-sqlite3 Skipping org.macports.activate (py25-sqlite3 ) since this port is already active --- Cleaning py25-sqlite3 vincent-daviss-macbook-pro-2:~ vmd$ -- http://mail.python.org/mailman/listinfo/python-list
Re: import _sqlite3 no module named error
In article 77e831100906041151g70868dbre1546cdb01082...@mail.gmail.com, Vincent Davis vinc...@vincentdavis.net wrote: Yes I am using macports I think sqlite is installed? here is what I get when I run sudo port install py25-sqlite3 vincent-daviss-macbook-pro-2:~ vmd$ sudo port install py25-sqlite3 Skipping org.macports.activate (py25-sqlite3 ) since this port is already active --- Cleaning py25-sqlite3 vincent-daviss-macbook-pro-2:~ vmd$ Hmm! This is on 10.5.7, BTW. $ sudo port version Version: 1.710 $ sudo port info py25-sqlite3 py25-sqlite3 @2.5.4 (python, databases) [...] $ /opt/local/bin/python2.5 Python 2.5.4 (r254:67916, May 4 2009, 01:40:08) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type help, copyright, credits or license for more information. from _sqlite3 import * A quick web search shows that there were apparently some issues with MacPort's py25-sqlite3 in the not too distant past. Perhaps your ports need to be upgraded? $ sudo port selfupdate or $ sudo port sync $ sudo port upgrade installed -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: import _sqlite3 no module named error
In article 77e831100906041718k4b4f54d9v29729449c50f...@mail.gmail.com, Vincent Davis vinc...@vincentdavis.net wrote: On Thu, Jun 4, 2009 at 1:41 PM, Ned Deily n...@acm.org wrote: [...] $ /opt/local/bin/python2.5 Python 2.5.4 (r254:67916, May 4 2009, 01:40:08) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type help, copyright, credits or license for more information. from _sqlite3 import * [...] Also 10.5.7 my self, I have completely removed and reinstall macport and all the ports. All befor posting this thread... here is what i get, jhgfjhgfjhg it is working now, I have no clue. I went on a bike ride and now it works? Thanks for you help. Good. Wish I could claim to have magic powers that made it all work. What do you know about python_select, .bash_profile and .profile? python_select is a shell script to manage multiple versions of MacPorts-supplied pythons. MacPorts allows you to install multiple versions of python, say python2.4 and python2.5. With python_select, you can select which version will be invoked by default, i.e. by /opt/local/bin/python. It does this by creating the proper symlinks within /opt/local which is the directory sub-tree containing MacPorts-installed files. There is more information in its man page. Things get even more complicated with python.org-installed pythons, each version of which has its own bin directory within a framework and which may have symlinks to it from /usr/local/bin. .bash_profile and .profile are two of the various startup files read by the various shells out there. In general, when dealing with multiple versions of the same command name, you can add commands to the appropriate shell startup files to modify the value of the PATH environment variable, which is what specifies the search path for commands. For example, if /opt/local/bin comes before /usr/bin in $PATH, the command python will invoke the MacPorts default python rather than the Apple-supplied python. PATH and shell startup files are all garden-variety Unix-y topics; there is plenty of info about them out there on the web. Another way to deal with multiple versions is to avoid ambiguity by always specifying the absolute path to the desired python, as in my earlier example above. There are other tactics, too, like defining shell aliases. Of course, each approach has its pluses and minuses. Hope that helps. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list