Re: [gtk-osx-users] ImportError: No module named gi.
- From: John Ralls <jralls ceridwen fremont ca us>
- To: Pascal <p p14 orange fr>
- Cc: gtk-osx-users-list gnome org
- Subject: Re: [gtk-osx-users] ImportError: No module named gi.
- Date: Fri, 5 Apr 2019 16:57:50 -0700
On Apr 5, 2019, at 1:22 PM, Pascal <p p14 orange fr> wrote:
Le 4 avr. 2019 à 02:42, John Ralls <jralls ceridwen fremont ca us> a écrit :
On Apr 3, 2019, at 1:34 PM, Pascal <p p14 orange fr> wrote:
Le 1 avr. 2019 à 23:25, John Ralls <jralls ceridwen fremont ca us> a écrit :
On Mar 31, 2019, at 10:22 AM, John Ralls <jralls ceridwen fremont ca us> wrote:
On Mar 31, 2019, at 7:49 AM, Pascal <p p14 orange fr> wrote:
Le 31 mars 2019 à 16:24, John Ralls <jralls ceridwen fremont ca us> a écrit :
On Mar 31, 2019, at 2:03 AM, Pascal <p p14 orange fr> wrote:
Does "gi" exist for python 2? How to get it?
Build pygobject3 with python2. pygobject is for Gtk2.
Python2 goes out of support at the end of *this year*. It's way past time that you covert your app to
python3. It's not hard, most apps can be converted in a day or two.
Thanks John for the clarification, I thought pygobject3 was for Python 3 :-(
I made this misunderstanding because I got this error with Python 2:
*** Building pygobject3 *** [4/4]
python setup.py build
Traceback (most recent call last):
File "setup.py", line 29, in <module>
import pkg_resources
ImportError: No module named pkg_resources
What is going on?
It's entirely possible that python2 support has been pulled from pygobject3. If that's the case then
you'll need to roll back to an older version of gtk-osx, modify and use local modulesets with an
earlier version of pygobject3, or update your application to python3.
README.rst says it supports python2, so I Googled pkg_resources. It's part of python and when I run
/usr/bin/python and say import pkg_resources it happily does so. Seems that you've broken your python
installation.
Hello John,
When I used Python installed by macOS it is ok:
$ which python
/usr/bin/python
$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pkg_resources
^D
But not with Python installed formerly with jhbuild:
$ PATH=$HOME/.local/bin:$PATH
$ jhbuild shell
Prefix: /usr/local/xnadalib-2018
Entered jhbuild shell, type 'exit' to return.
[JH]$ which python
/usr/local/xnadalib-2018/bin/python
[JH]$ python
Python 2.7.14 (default, Sep 13 2018, 10:35:57)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pkg_resources
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pkg_resources
So I uninstalled python and installed it again.
I have now a different error:
*** Building pygobject3 *** [4/4]
python setup.py build
Traceback (most recent call last):
File "setup.py", line 30, in <module>
from setuptools import setup
ImportError: No module named setuptools
Pascal,
Drop to the shell and run
python -m ensurepip
to install setuptools and pip.
Control-d to return and rerun the build
AhAh thanks John, pip, setuptools and ... pkg_resources come into site-package folder :-)
And ... "gi" comes with pygobject3 :-)
On the side of my app (well the app I try to port on macOS) is running with lots of gtk-warning but it is
running.
By the way, how can I help with your new buid system from
https://github.com/jralls/gtk-osx-build/tree/pipenv?
Pascal,
Great that you're up-and-running.
You can help with the pipenv branch by testing it and telling me about any problems. I don't have anything at
hand that uses python2 so I haven't done much testing with it.
Regards,
John Ralls
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]