From: Bruce S. <bas...@nc...> - 2010-12-21 04:35:26
|
I wonder whether someone on the list can help me with a puzzle having to do with installing on Linux. In acinclude.m4 is the following fragment which attempts to identify where to install modules such as Visual: [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] When autogen.sh and configure are run before doing a make to build Visual, this fragment generates a reference to site-packages, which is unfortunate, because on Ubuntu with Python 2.x site-packages is not normally on the module search path. If on the other hand I execute the following I get a reference to dist-packages, as expected and desired: from distutils import sysconfig print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') I can't understand why I'm getting a reference to site-packages in the autoconfigure machinery. I'm reluctant to hand-code "dist-packages" because for all I know other Linux distributions use site-packages and have site-packages on the module search path. (As an aside, I'm annoyed that Ubuntu has left site-packages off the search path, though I notice that it seems to be back on the search path for Python 3.) Bruce Sherwood |
From: C A. R. <an...@ex...> - 2010-12-21 04:53:46
|
On Mon, Dec 20, 2010 at 10:35 PM, Bruce Sherwood <bas...@nc...> wrote: > I wonder whether someone on the list can help me with a puzzle having > to do with installing on Linux. > > In acinclude.m4 is the following fragment which attempts to identify > where to install modules such as Visual: > > [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; > print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" > 2>/dev/null || > echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] > > When autogen.sh and configure are run before doing a make to build > Visual, this fragment generates a reference to site-packages, which is > unfortunate, because on Ubuntu with Python 2.x site-packages is not > normally on the module search path. > > If on the other hand I execute the following I get a reference to > dist-packages, as expected and desired: > > from distutils import sysconfig > print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') > > I can't understand why I'm getting a reference to site-packages in the > autoconfigure machinery. I'm reluctant to hand-code "dist-packages" > because for all I know other Linux distributions use site-packages and > have site-packages on the module search path. (As an aside, I'm > annoyed that Ubuntu has left site-packages off the search path, though > I notice that it seems to be back on the search path for Python 3.) this is only for ubuntu, right (appears that way)? i don't run ubuntu, so i can't really test, but are you sure autotools is picking up the same version of python that you get when you just run `python` in the terminal? i use archlinux, and recently we switched to py3k by default... so i've had to deal with problems like that, and this feels like one of those problems. otherwise, there is something different in the environments between your terminal and autotools, but i'm not sure how to dump the ENV from within the macro. C Anthony |
From: Bruce S. <bas...@nc...> - 2010-12-21 05:05:41
|
It does seem to be using the desired version of Python, as the full path created is /usr/local/lib/python2.6/site-packages which contains the intended python2.6. I also tried replacing $PYTHON with python$PYTHON_VERSION and still got site-packages. It's really hard to understand how sysconfig.get_python_lib can act differently within the autoconfigure environment. Bruce Sherwood On Mon, Dec 20, 2010 at 9:53 PM, C Anthony Risinger <an...@ex...> wrote: > On Mon, Dec 20, 2010 at 10:35 PM, Bruce Sherwood <bas...@nc...> wrote: >> I wonder whether someone on the list can help me with a puzzle having >> to do with installing on Linux. >> >> In acinclude.m4 is the following fragment which attempts to identify >> where to install modules such as Visual: >> >> [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" >> 2>/dev/null || >> echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] >> >> When autogen.sh and configure are run before doing a make to build >> Visual, this fragment generates a reference to site-packages, which is >> unfortunate, because on Ubuntu with Python 2.x site-packages is not >> normally on the module search path. >> >> If on the other hand I execute the following I get a reference to >> dist-packages, as expected and desired: >> >> from distutils import sysconfig >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') >> >> I can't understand why I'm getting a reference to site-packages in the >> autoconfigure machinery. I'm reluctant to hand-code "dist-packages" >> because for all I know other Linux distributions use site-packages and >> have site-packages on the module search path. (As an aside, I'm >> annoyed that Ubuntu has left site-packages off the search path, though >> I notice that it seems to be back on the search path for Python 3.) > > this is only for ubuntu, right (appears that way)? > > i don't run ubuntu, so i can't really test, but are you sure autotools > is picking up the same version of python that you get when you just > run `python` in the terminal? > > i use archlinux, and recently we switched to py3k by default... so > i've had to deal with problems like that, and this feels like one of > those problems. otherwise, there is something different in the > environments between your terminal and autotools, but i'm not sure how > to dump the ENV from within the macro. > > C Anthony > |
From: Jacob S. <sch...@ro...> - 2010-12-21 05:18:24
|
I should clarify that both versions of my pythons return site-packages when run from the command prompt Jacob On Mon, 2010-12-20 at 22:05 -0700, Bruce Sherwood wrote: > It does seem to be using the desired version of Python, as the full > path created is > > /usr/local/lib/python2.6/site-packages > > which contains the intended python2.6. I also tried replacing $PYTHON > with python$PYTHON_VERSION and still got site-packages. It's really > hard to understand how sysconfig.get_python_lib can act differently > within the autoconfigure environment. > > Bruce Sherwood > > On Mon, Dec 20, 2010 at 9:53 PM, C Anthony Risinger <an...@ex...> wrote: > > On Mon, Dec 20, 2010 at 10:35 PM, Bruce Sherwood <bas...@nc...> wrote: > >> I wonder whether someone on the list can help me with a puzzle having > >> to do with installing on Linux. > >> > >> In acinclude.m4 is the following fragment which attempts to identify > >> where to install modules such as Visual: > >> > >> [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; > >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" > >> 2>/dev/null || > >> echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] > >> > >> When autogen.sh and configure are run before doing a make to build > >> Visual, this fragment generates a reference to site-packages, which is > >> unfortunate, because on Ubuntu with Python 2.x site-packages is not > >> normally on the module search path. > >> > >> If on the other hand I execute the following I get a reference to > >> dist-packages, as expected and desired: > >> > >> from distutils import sysconfig > >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') > >> > >> I can't understand why I'm getting a reference to site-packages in the > >> autoconfigure machinery. I'm reluctant to hand-code "dist-packages" > >> because for all I know other Linux distributions use site-packages and > >> have site-packages on the module search path. (As an aside, I'm > >> annoyed that Ubuntu has left site-packages off the search path, though > >> I notice that it seems to be back on the search path for Python 3.) > > > > this is only for ubuntu, right (appears that way)? > > > > i don't run ubuntu, so i can't really test, but are you sure autotools > > is picking up the same version of python that you get when you just > > run `python` in the terminal? > > > > i use archlinux, and recently we switched to py3k by default... so > > i've had to deal with problems like that, and this feels like one of > > those problems. otherwise, there is something different in the > > environments between your terminal and autotools, but i'm not sure how > > to dump the ENV from within the macro. > > > > C Anthony > > > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Jacob S. <sch...@ro...> - 2010-12-21 05:18:29
|
Bruce, Ubuntu Lucid Lynx 10.04 ======================= Python 2.6.5 installed by default Python 3.1.2 installed from repositories I find this code in /usr/lib/python3.1/distutils/sysconfig.py under the function get_python_lib if os.name == "posix": libpython = os.path.join(prefix, "lib", "python" + get_python_version()) if standard_lib: return libpython elif is_default_prefix and 'PYTHONUSERBASE' not in os.environ and 'real_prefix' not in sys.__dict__: return os.path.join(libpython, "dist-packages") else: return os.path.join(libpython, "site-packages") It appears to suggest that the choice is made due to the elif line, which appears to automatically choose 'site-packages' if you send in a particular prefix. Also, I would like to inform you that in my installation (Python 3.1.2), site-packages is not on the search path, and the folder does not even exist! P.S. - Same result as above for my Python 2.6.5 installation HTH, Jacob Schmidt On Mon, 2010-12-20 at 21:35 -0700, Bruce Sherwood wrote: > I wonder whether someone on the list can help me with a puzzle having > to do with installing on Linux. > > In acinclude.m4 is the following fragment which attempts to identify > where to install modules such as Visual: > > [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; > print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" > 2>/dev/null || > echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] > > When autogen.sh and configure are run before doing a make to build > Visual, this fragment generates a reference to site-packages, which is > unfortunate, because on Ubuntu with Python 2.x site-packages is not > normally on the module search path. > > If on the other hand I execute the following I get a reference to > dist-packages, as expected and desired: > > from distutils import sysconfig > print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') > > I can't understand why I'm getting a reference to site-packages in the > autoconfigure machinery. I'm reluctant to hand-code "dist-packages" > because for all I know other Linux distributions use site-packages and > have site-packages on the module search path. (As an aside, I'm > annoyed that Ubuntu has left site-packages off the search path, though > I notice that it seems to be back on the search path for Python 3.) > > Bruce Sherwood > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Bruce S. <bas...@nc...> - 2010-12-21 05:16:45
|
Thanks much for the detailed information, though I don't understand why this would function differently within and without the autoconfigure environment. As for site-packages being on the Python 3.1 search path, I see that I had forgotten that I had put a .pth file in /usr/local/python3.1/dist-packages to specify site-packages. Sorry for the confusion (and sorry that Ubuntu has caused a lot of people grief by not including site-packages, as judged from chatter on the web). An amusing aside: I chose the menu option System > About Ubuntu and got the following remarkable message from the future: You are using Ubuntu 11.04 - the Natty Narwhal - released in April 2011 and supported until October 2012. However, I believe I'm using 10.10. Bruce Sherwood On Mon, Dec 20, 2010 at 10:06 PM, Jacob Schmidt <sch...@ro...> wrote: > Bruce, > > Ubuntu Lucid Lynx 10.04 > ======================= > Python 2.6.5 installed by default > Python 3.1.2 installed from repositories > > > I find this code in /usr/lib/python3.1/distutils/sysconfig.py > under the function get_python_lib > > > > if os.name == "posix": > libpython = os.path.join(prefix, > "lib", "python" + get_python_version()) > if standard_lib: > return libpython > elif is_default_prefix and 'PYTHONUSERBASE' not in os.environ > and 'real_prefix' not in sys.__dict__: > return os.path.join(libpython, "dist-packages") > else: > return os.path.join(libpython, "site-packages") > > > > It appears to suggest that the choice is made due to the elif line, > which appears to automatically choose 'site-packages' if you send in a > particular prefix. > > Also, I would like to inform you that in my installation (Python 3.1.2), > site-packages is not on the search path, and the folder does not even > exist! > > P.S. - Same result as above for my Python 2.6.5 installation > > HTH, > Jacob Schmidt > > On Mon, 2010-12-20 at 21:35 -0700, Bruce Sherwood wrote: >> I wonder whether someone on the list can help me with a puzzle having >> to do with installing on Linux. >> >> In acinclude.m4 is the following fragment which attempts to identify >> where to install modules such as Visual: >> >> [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX').replace('\\\\\','/'))" >> 2>/dev/null || >> echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/dist-packages"`] >> >> When autogen.sh and configure are run before doing a make to build >> Visual, this fragment generates a reference to site-packages, which is >> unfortunate, because on Ubuntu with Python 2.x site-packages is not >> normally on the module search path. >> >> If on the other hand I execute the following I get a reference to >> dist-packages, as expected and desired: >> >> from distutils import sysconfig >> print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX') >> >> I can't understand why I'm getting a reference to site-packages in the >> autoconfigure machinery. I'm reluctant to hand-code "dist-packages" >> because for all I know other Linux distributions use site-packages and >> have site-packages on the module search path. (As an aside, I'm >> annoyed that Ubuntu has left site-packages off the search path, though >> I notice that it seems to be back on the search path for Python 3.) >> >> Bruce Sherwood >> >> ------------------------------------------------------------------------------ >> Lotusphere 2011 >> Register now for Lotusphere 2011 and learn how >> to connect the dots, take your collaborative environment >> to the next level, and enter the era of Social Business. >> http://p.sf.net/sfu/lotusphere-d2d >> _______________________________________________ >> Visualpython-users mailing list >> Vis...@li... >> https://lists.sourceforge.net/lists/listinfo/visualpython-users > > > > > |
From: C A. R. <an...@ex...> - 2010-12-21 05:19:28
|
On Mon, Dec 20, 2010 at 11:05 PM, Bruce Sherwood <bas...@nc...> wrote: > It does seem to be using the desired version of Python, as the full > path created is > > /usr/local/lib/python2.6/site-packages > > which contains the intended python2.6. I also tried replacing $PYTHON > with python$PYTHON_VERSION and still got site-packages. It's really > hard to understand how sysconfig.get_python_lib can act differently > within the autoconfigure environment. /usr/local? shouldn't it be trying to link with the package manager's version? at least, that's what your probably getting when you run `python` unless your doing something different. C Anthony |
From: Bruce S. <bas...@nc...> - 2010-12-22 00:18:30
|
The appearance of "/usr/local" here is due to having specified PYTHON=/usr/bin/python2.6 and --prefix=/usr/local in the configure step for building Visual. On Ubuntu there exist /usr/lib/python2.6/dist-packages and also /usr/local/lib/python2.6/dist-packages, and it is the latter folder where 3rd-party modules like Visual are apparently supposed to be installed. Bruce Sherwood On Mon, Dec 20, 2010 at 10:19 PM, C Anthony Risinger <an...@ex...> wrote: > On Mon, Dec 20, 2010 at 11:05 PM, Bruce Sherwood <bas...@nc...> wrote: >> It does seem to be using the desired version of Python, as the full >> path created is >> >> /usr/local/lib/python2.6/site-packages >> >> which contains the intended python2.6. I also tried replacing $PYTHON >> with python$PYTHON_VERSION and still got site-packages. It's really >> hard to understand how sysconfig.get_python_lib can act differently >> within the autoconfigure environment. > > /usr/local? shouldn't it be trying to link with the package manager's > version? at least, that's what your probably getting when you run > `python` unless your doing something different. > > C Anthony > |
From: Guy K. K. <guy...@au...> - 2010-12-22 03:59:42
|
On Wed, 22 Dec 2010 13:18:22 Bruce Sherwood wrote: > The appearance of "/usr/local" here is due to having specified > PYTHON=/usr/bin/python2.6 and --prefix=/usr/local in the configure > step for building Visual. On Ubuntu there exist > /usr/lib/python2.6/dist-packages and also > /usr/local/lib/python2.6/dist-packages, Commonly user contributed installs should only go to e. g. /usr/local or /opt. Only distribution packages (including those from third parties) should install straight into the default file system hierarchy. > and it is the latter folder where 3rd-party modules like Visual are > apparently supposed to be installed. Indeed. If I download the sources, compile and install, it should usually go into the /usr/local hierarchy. If there's something like a "make deb" or "make rpm" then that install can also go into the default system level hierarchy, as they're managed packages that can be properly maintained through the system provided packaging tools. HTH, Guy -- Guy K. Kloss School of Computing + Mathematical Sciences Auckland University of Technology Private Bag 92006, Auckland 1142 phone: +64 9 921 9999 ext. 5032 eMail: Guy...@au... |