I was about to set up pygobject for gtk+3. This http://python-gtk-3-tutorial.readthedocs.org/en/latest/install.html#id2 page says I need Jhbuild. I went ahead and installed that. But, it gives me traceback
Traceback (most recent call last):
File "/usr/bin/jhbuild", line 6, in <module>
import __builtin__
ImportError: No module named '__builtin__'
Which obviously is due to wrong version of python(my default is python3).
So, I found this page https://wiki.gnome.org/Projects/Jhbuild/Dependencies/ArchLinux
Which suggests to add
os.environ['PYTHON'] = '/usr/bin/python2'
line to ~/.config/jhbuildrc which I did. When I run jhbuild again it spews the same traceback.
I tried putting the file as ~/.jhbuildrc. Doesn't work either.
So, I'm stuck here. Any help would be appreciated.
I'm on Arch Linux, fwiw.
You probably want to set PYTHON=/usr/bin/python2 when you ./autogen.sh --simple-install for jhbuild itself. The jhbuildrc file is only used for things it builds.
See also: https://wiki.archlinux.org/index.php/JHBuild
Related
I'm getting an error when I try to run my tool from the command line. I've created a setup.py file and put together the entry point. This command line util works when I clone the repo and install on other computers. I wonder if the issue has something to do with the dev tag thats included in the location of package. ('this_tool==0.1.1.dev11')
By using python setup.py --version it's on 0.1.1.dev16. But I'm not sure how to fix this as rerunning the setup.py install doesn't seem to fix the problem.
Traceback (most recent call last):
File "/Users/USERNAME/miniconda2/envs/USERNAME/bin/this_tool", line 30, in <module>
sys.exit(load_entry_point('this_tool==0.1.1.dev11', 'console_scripts', 'this_tool')())
File "/Users/USERNAME/miniconda2/envs/USERNAME/bin/this_tool", line 22, in importlib_load_entry_point
return next(matches).load()
StopIteration
I can provide my setup.py if needed too, but since it seemed to work on the other computers I don't think that's the problem
In my case this happened when i had two versions of the same package. An older version which didn't have the script and a new version with the console_script installed by setup.py.
The discussion in https://github.com/pypa/setuptools/issues/2390
pointed me in the direction to try out a
pip uninstall mypackage
and i was asked interactively to remove the older version of the package.
After that the StopIteration issue went away.
I had the exact same problem with BorgBackup installed from Entware-ng (opkg) on my NAS
$ /opt/bin/borg
Traceback (most recent call last):
File "/opt/bin/borg", line 33, in <module>
sys.exit(load_entry_point('borgbackup==1.1.16', 'console_scripts', 'borg')())
File "/opt/bin/borg", line 25, in importlib_load_entry_point
return next(matches).load()
StopIteration
and as #anup-jonchhe commented above, a fresh install indeed solved the problem.
But I could also fix this issue without a full reinstallation.
In my setup, the problem occurred right after an update of the tool
opkg update && opkg upgrade python3-borgbackup
The problem is that the upgrade process left some conflicting directory which raised the error
In the directory /opt/lib/python3.9/site-packages
the upgrade from BorgBackup 1.1.15-1 to 1.1.16-1 left the old directory
borgbackup-1.1.15-py3.9.egg-info/
next to the new one
borgbackup-1.1.16-py3.9.egg-info/
After removing manually the old one (1.1.15), borg would run again without any problem
I am attempting to install this https://github.com/jordens/pyflycapture2 python binding on my Windows machine. The readme only has instructions on how to do it for Linux systems, but I imagine the library should still work.
I am able to run "python setup.py install" and it seems to successfully complete, but when I try to run "python test_flycapture2.py" I get this error:
C:\Users\clinic\Desktop\pyflycapture2>python test_flycapture2.py Traceback (most recent call last):
File "test_flycapture2.py", line 20, in <module>
import flycapture2 as fc2
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
This seems to imply that flycapture2 wasn't installed correctly. When I instead just open a python session and do "import flycapture2" I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Have I done something wrong with the installation process or does pyflycapture2 just not work with Windows?
A dumb solution that's worth a try. There are chances that the DLL are searched directly from where you're starting the python script. So if you have the dll somewhere on your computer, copy it along where you have your test_flycapture2.py.
But given the fact that the setup.py file has a whole bunch of absolute paths in there, I would not place my hopes too high. You can also try to install FlyCapture 2 at the exact same path, run python setup.py bdist_wheel (you will need to install wheel first with pip) in the pyflycapture2 folder, and see if that succeeds.
If it does, try installing the generated wheel (that will be in dist/ subfolder) by doing pip install dist/pyfly....wheel and test again.
Hope this helps
I'm answering this mostly because I found another post where the same question had been posted but the original problem was never answered.
How do I run an installed Python module on Windows?
In the comments, the original poster says that it suddenly started working. I found that the solution was simply to restart my computer. I have now attempted this on two computers and this worked for both of them.
I am trying to create an exe from python code. I can run the code just fine from the command line like this:
python myScript.py
I have installed py2exe from here: http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/
And, have a setup.py that looks like this:
from distutils.core import setup
import py2exe
setup(console=['myScript.py'])
And, I run the setup.py like this:
python setup.py py2exe
I get the following in the output:
The following modules appear to be missing
['Carbon', 'Carbon.Files', '__pypy__', '_scproxy', 'http_parser.http', 'http_parser.reader', 'jinja2._debugsupport', 'jinja2._markupsafe._speedups',
'jinja2.debugrenderer', 'markupsafe', 'pretty', 'socketpool', 'socketpool.util']
And, sure enough, if I try to run the exe, I get errors:
$ ./myScript.exe
Traceback (most recent call last):
File "restkit\__init__.pyc", line 9, in <module>
File "restkit\conn.pyc", line 14, in <module>
ImportError: No module named socketpool
Traceback (most recent call last):
File "myScript.py", line 12, in <module>
ImportError: cannot import name Resource
What do I need to do to get py2exe to find the dependencies?
Thanks
Carbon is the name of two different Mac-specific things.
First, in 2.x, on both Mac OS X and Mac Classic builds, has a Carbon package in the standard library, used for calling Carbon/Toolbox APIs (and, in OS X, CoreFoundation and friends).
Second, in both 2.x and 3.x, on Mac OS X, with PyObjC, the PyObjC wrapper around Carbon.Framework is named Carbon. (PyObjC isn't part of the stdlib, but it does come with Apple builds of Python, and most third-party builds besides python.org's official installers.)
Neither of these will exist on Windows.
py2exe tries to be smart and only import things relevant to your platform. However, it's pretty easy to fool. For example, something like this:
try:
import Carbon.Files
except:
Carbon = collections.namedtuple('Carbon', 'Files')
Carbon.Files = None
if Carbon.Files:
Carbon.Files.whatever(…)
… might make py2exe think Carbon.Files is required.
Now, obviously this isn't your whole problem, but it is a very big red flag that py2exe's module dependency code is not working for your project. You probably have similar problems with all kinds of other modules, so it's both missing some things you need and demanding some things you don't have, and this is probably what's causing your actual problems.
As the FAQ explains, you can debug this by running the module-finder code to see where it's going wrong, like this:
python -m py2exe.mf -d path/to/my_file.py
You could use this information to guide the module-finder code, or to rewrite your code so you don't confuse py2exe.
Or, more simply, just explicitly include and exclude modules in your setup.py as a workaround, without worrying about why they're getting incorrectly detected.
py2exe is python version dependent. Everything you're doing seems to be correct, I would guess you have the wrong version installed.
Okay i've been battling for this for 2 days, that usually means its something too simple to realize.
I have an embedded linux system which I cross compile on my ubuntu. When compiling python, sqlite3 is not on the list of modules that have not been able to be compiled.
But, the _sqlite3.so library is not in the same location as for example json.so and ctypes.so array.so...
in Python-2.6.6/build/lib.linux868-2.6/
The actual module with the init-functions etc is in the right place at :
in Python-2.6.6/modules and it can also be found on the target system.
Since the so-file was missing, i tried compiling it myself as a shared library using my arm-compiler. This did not work either.
Without manually compiled so-file:
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rootfs/python/lib/python2.6/sqlite3/__init__.py", line 24, in <module>
File "rootfs/python/lib/python2.6/sqlite3/dbapi2.py", line 27, in <module>
ImportError: /python/lib/python2.6/lib-dynload/_sqlite3.so: cannot open shared object file: No such file or directory
With the compiled shared library found at lib-dynloads:
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rootfs/python/lib/python2.6/sqlite3/__init__.py", line 24, in <module>
File "rootfs/python/lib/python2.6/sqlite3/dbapi2.py", line 27, in <module>
ImportError: dynamic module does not define init function (init_sqlite3)
Edit:
I was wondering if i had compiled the right library for sqlite3. As far as i now understand the _sqlite3.so is something the python builder makes and libsqlite3.so is the library it needs to build it? And libsqlite3.so is build from Sqlite3-source code. Am i mistaken here?
Anyone with more embedded Linux or Python experience have an idea what I am doing wrong here?
Try to compile and install sqlite3 first on your system, and compiler python later. Or just
easy_install pysqlite
Ok, figured this out. Somehow I did not manually compile the SO-file correctly. Got this to work like so:
First from setup.py , I added verbose debugging enabled for sqlite3 module. This added a printout that solved the problem:
skipping incompatible /usr/lib/libsqlite3.so
cannot find -sqlite3
That made me realize that the setup.py had chosen the first path where it found any module named sqlite3, ignoring it's architecture alltogether. Removing other search paths from the setup.py, but the one i had the ARM compiled library in, made it work. The _sqlite3.so was compiled nicely with all the other modules.
Hi
I'm not familiar with python, I just want to check something so I tried to run a .py code in linux so I wrote :
./waf wifi-olsr-flowmon --plot
which is a .py program after that whatever I want to run just see these error:
/home/bahar/Desktop/ns/ns-allinone-3.9/ns-allinone-3.9/ns-3.9/wscript: error: Traceback (most recent call last):
File "/home/bahar/Desktop/ns/ns-allinone-3.9/ns-allinone-3.9/ns-3.9/.waf-1.5.16-e6d03192b5ddfa5ef2c8d65308e48e42/wafadmin/Utils.py", line 197, in load_module
exec(compile(code,file_path,'exec'),module.__dict__)
File "/home/bahar/Desktop/ns/ns-allinone-3.9/ns-allinone-3.9/ns-3.9/wscript", line 32, in <module>
import cflags # override the build profiles from waf
ImportError: No module named cflags
I dont know what does it mean or why it happened, would you please tell me what is the problem .
may be I should add this note that even now that I don't want to run any .py code and just wana run .cc I can't do it and see this error always
Bests
It means that Python was unable to locate a module named cflags, but the code you're running tries to import it. Perhaps you need to set PYTHONPATH, or install the cflags module.
(Also, paragraphs are your friend.)