Re: "pip install scons" result in a broken installation that is unusable

"Fux Samuel (ID SIS)" <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
Dear Bill,

Thank you for your reply.

For me it still fails:

[sfux@lo-login-01 ~]$ pip install --index-url https://test.pypi.org/simple/ scons==3.1.0.alpha.20181011
Looking in indexes: https://test.pypi.org/simple/
Collecting scons==3.1.0.alpha.20181011
Installing collected packages: scons
Successfully installed scons-3.1.0a20181011
[sfux@lo-login-01 ~]$ scons
SCons import failed. Unable to find engine files in:
  /cluster/apps/python/2.7.14/bin/../engine
  /cluster/apps/python/2.7.14/bin/scons-local-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/bin/scons-local
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/python2.7/site-packages/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib64/scons-3.1.0.alpha.20181011
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/scons
  /cluster/apps/python/2.7.14/lib/scons
  /cluster/apps/python/2.7.14/lib/scons
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14/lib64/scons
Traceback (most recent call last):
  File "/cluster/apps/python/2.7.14/bin/scons", line 192, in <module>
    import SCons.Script
ImportError: No module named SCons.Script
[sfux@lo-login-01 ~]$

Not using virtualenv is a personal preference, like not using Anaconda to install Python itself or like preferring pip over distutils. I don't like the additional step of activating the virtualenv because I would like to keep things as simple as possible for our cluster users.

If virtualenv is a hard requirement for using SCons, then this should be added to the Readme.md file on github. Currently the Readme.md file states with regards to dependencies:
Execution Requirements

Running SCons requires Python version 2.7.* and Python 3.5 or higher. There should be no other dependencies or requirements to run SCons.

Installation Requirements

Nothing special.

Best regards

Sam

--
ETH Zurich, Dr. sc. ETH Samuel Fux
High Performance Computing, Scientific IT Services
WEC D 13, Weinbergstrasse 11, 8092 Zurich, Switzerland
Phone +41 44 632 57 63, http://www.id.ethz.ch/
[email protected]
________________________________
Von: Scons-users [[email protected]]" im Auftrag von "Bill Deegan [[email protected]]
Gesendet: Donnerstag, 11. Oktober 2018 19:45
An: SCons users mailing list
Betreff: Re: [Scons-users] "pip install scons" result in a broken installation that is unusable

This issue is resolved by patch merged into master in may.
https://github.com/SCons/scons/pull/3134

You can try via package I just uploaded to testpypi
pip install --index-url https://test.pypi.org/simple/ scons==3.1.0.alpha.20181011

Please let me know if this works for you.
I tried in a freshly built python on my linux system.
Seems to work for me.

-Bill



On Thu, Oct 11, 2018 at 1:37 PM Mats Wichmann <[email protected]<mailto:[email protected]>> wrote:
On 10/11/2018 10:37 AM, Mats Wichmann wrote:
> On 10/11/2018 10:19 AM, Bill Deegan wrote:
>> It should work with recent pip.
>> Let me take a look today.
>> -Bill
>
> IMO, some of the paths are ready as they are and should not be joined
> with further bits. a little reorg is needed there.

to be a little less cryptic, it seems that the very first place a path
could be added to prefs is here:

# - running from egg check
try:
    import pkg_resources
except ImportError:
    pass
else:
    # when running from an egg add the egg's directory
    try:
        d = pkg_resources.get_distribution('scons')
    except pkg_resources.DistributionNotFound:
        pass
    else:
        prefs.append(d.location)

This stanza succeeds on all kinds of installations, "running from egg"
does not seem precise; whatever get_distribution looks for is found both
in Linux distro packages and pip installed locations.  This gives you
back a path that does not want 'lib' or 'lib/pythonX.Y/site-packages'
appended. For example for a particular virtualenv that has pip-install'd
scons, that stanza yields:

/home/mats/.virtualenvs/py27+scons/lib/python2.7

Further down, after the appending that happens in the two list
comprehensions to all the paths in prefs, that expanded to these two:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages

which are throwaways, engine will never be found in those after they are
expanded to these four locations on the final round:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/scons
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/lib/python2.7/site-packages/scons

there is no site-packages/lib and definitely no
site-packages/lib/.../site-packages - really this is the problem Samuel
is seeing.

What we really wanted to generate from that original first path was:

/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/scons-3.0.1
/home/mats/.virtualenvs/py27+scons/lib/python2.7/site-packages/scons

_______________________________________________
Scons-users mailing list
[email protected]<mailto:[email protected]>
https://pairlist4.pair.net/mailman/listinfo/scons-users

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.