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]>
Hi Bill,

Thank you for your reply. I updated pip, but scons is still broken:
[sfux@lo-login-02 ~]$ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 763kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-18.1
[sfux@lo-login-02 ~]$ pip install scons
Collecting scons
Installing collected packages: scons
Successfully installed scons-3.0.1
[sfux@lo-login-02 ~]$ scons
SCons import failed. Unable to find engine files in:
  /cluster/apps/python/2.7.14_cpu/bin/../engine
  /cluster/apps/python/2.7.14_cpu/bin/scons-local-3.0.1
  /cluster/apps/python/2.7.14_cpu/bin/scons-local
  /cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/lib/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib64/scons-3.0.1
  /cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/lib/scons
  /cluster/apps/python/2.7.14_cpu/lib/scons
  /cluster/apps/python/2.7.14_cpu/lib/scons
  /cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14_cpu/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14_cpu/lib/python2.7/site-packages/scons
  /cluster/apps/python/2.7.14_cpu/lib64/scons
Traceback (most recent call last):
  File "/cluster/apps/python/2.7.14_cpu/bin/scons", line 192, in <module>
    import SCons.Script
ImportError: No module named SCons.Script
[sfux@lo-login-02 ~]$
The following workaround fixes the problem
export SCONS_LIB_DIR=/cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/scons-3.0.1
This is not my preferred solution as I would like to avoid setting environment variables for all users that use Python on our hpc cluster if it is only required for Scons.

The issues arises from line 157 in /cluster/apps/python/2.7.14_cpu/bin/scons:
    temp = [os.path.join(x, 'lib') for x in prefs]
Because of adding "lib", to the guess for the path of the scons files, scons searches in
/cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/lib/scons-3.0.1
instead of
/cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/scons-3.0.1
After changing
   temp = [os.path.join(x, 'lib') for x in prefs]
to
   temp = [os.path.join(x, '') for x in prefs]
scons does not show this error any more:
[sfux@lo-login-02 bin]$ scons

scons: *** No SConstruct file found.
File "/cluster/apps/python/2.7.14_cpu/lib64/python2.7/site-packages/scons-3.0.1/SCons/Script/Main.py", line 924, in _main
[sfux@lo-login-02 bin]$
I will use this workaround as it avoids setting environment variables. It is clear to me, that this only fixes the problem on our system, and maybe for other sites there is a different solution required.

Would it make sense to open an issue on github to share my findings, as it seems that many people are facing this problem ?

  *   https://github.com/FPGAwars/apio/issues/143
  *   https://github.com/Homebrew/legacy-homebrew/issues/5794
  *   https://stackoverflow.com/questions/24897687/import-failed-unable-to-find-scons-files-import-scons-script
  *   https://stackoverflow.com/questions/24897687/import-failed-unable-to-find-scons-files-import-scons-script/32540784
  *   http://scons.1086193.n5.nabble.com/SCons-can-t-correctly-install-via-pip-when-not-in-a-virtualenv-td42715.html
  *   https://pairlist4.pair.net/pipermail/scons-users/2017-December/006589.html

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: Mittwoch, 10. Oktober 2018 18:42
An: SCons users mailing list
Betreff: Re: [Scons-users] "pip install scons" result in a broken installation that is unusable

Sam,

Try:

# update your pip and wheel package there have been significant changes since py 2.7.14
pip install -U pip wheel
Then retry installing scons.

-Bill

On Wed, Oct 10, 2018 at 3:53 AM Fux Samuel (ID SIS) <[email protected]<mailto:[email protected]>> wrote:
Hi,

I installed scons 3.0.1 with the command
pip install scons
on our hpc cluster, using Python 2.7.14. The installation seems to be pretty broken:
[sfux@lo-login-02 ~]$ pip install scons
Collecting scons
Installing collected packages: scons
Successfully installed scons-3.0.1
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[sfux@lo-login-02 ~]$ 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.0.1
  /cluster/apps/python/2.7.14/bin/scons-local
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/scons-3.0.1
  /cluster/apps/python/2.7.14/lib/scons-3.0.1
  /cluster/apps/python/2.7.14/lib/scons-3.0.1
  /cluster/apps/python/2.7.14/lib64/python2.7/site-packages/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14/lib/python2.7/site-packages/scons-3.0.1
  /cluster/apps/python/2.7.14/lib64/scons-3.0.1
  /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-02 ~]$ which python
/cluster/apps/python/2.7.14/bin/python
[sfux@lo-login-02 ~]$ which pip
/cluster/apps/python/2.7.14/bin/pip
[sfux@lo-login-02 ~]$ cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[sfux@lo-login-02 ~]$
Is this a known problem ?

Can scons be installed with pip without using a virtualenv ?

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]<mailto:[email protected]>
_______________________________________________
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.