PolyChord / PolyChordLite

Public version of PolyChord: See polychord.co.uk for PolyChordPro
https://polychord.io/
Other
83 stars 26 forks source link

Install in a specific directory #35

Closed anusurendra closed 4 years ago

anusurendra commented 4 years ago

Hi,

Is there a way to specify the install into a specific directory. I am try to install on a Centos7 system.

williamjameshandley commented 4 years ago

Hi @anusurendra . Is this installing the python version, or the fortran library? If you just need to install it in python locally you can either install it on a per-user basis python setup.py install --user, or use a virtual environment

anusurendra commented 4 years ago

@williamjameshandley ,

With the python version, would I indicate the user directory after --user. I am an admin on a HPC system and would like to specify a global installation directory.

williamjameshandley commented 4 years ago

It looks like setup.py is pretty flexible with regards to this:

python setup.py install --help

Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)  run verbosely (default)
  --quiet (-q)    run quietly (turns verbosity off)
  --dry-run (-n)  don't actually do anything
  --help (-h)     show detailed help message
  --no-user-cfg   ignore pydistutils.cfg in your home directory

Options for 'install' command:
  --prefix                             installation prefix
  --exec-prefix                        (Unix only) prefix for platform-
                                       specific files
  --home                               (Unix only) home directory to install
                                       under
  --install-base                       base installation directory (instead of
                                       --prefix or --home)
  --install-platbase                   base installation directory for
                                       platform-specific files (instead of --
                                       exec-prefix or --home)
  --root                               install everything relative to this
                                       alternate root directory
  --install-purelib                    installation directory for pure Python
                                       module distributions
  --install-platlib                    installation directory for non-pure
                                       module distributions
  --install-lib                        installation directory for all module
                                       distributions (overrides --install-
                                       purelib and --install-platlib)
  --install-headers                    installation directory for C/C++
                                       headers
  --install-scripts                    installation directory for Python
                                       scripts
  --install-data                       installation directory for data files
  --compile (-c)                       compile .py to .pyc [default]
  --no-compile                         don't compile .py files
  --optimize (-O)                      also compile with optimization: -O1 for
                                       "python -O", -O2 for "python -OO", and
                                       -O0 to disable [default: -O0]
  --force (-f)                         force installation (overwrite any
                                       existing files)
  --skip-build                         skip rebuilding everything (for
                                       testing/debugging)
  --record                             filename in which to record list of
                                       installed files
  --user                               install in user site-package
                                       '/home/will/.local/lib/python3.7/site-
                                       packages'
  --old-and-unmanageable               Try not to use this!
  --single-version-externally-managed  used by system package builders to
                                       create 'flat' eggs

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

So it looks like --install-base, --root, or --home are probably the commands you're looking for.

anusurendra commented 4 years ago

@williamjameshandley ,

Thanks, I will use the install-base parameter to install.

anusurendra commented 4 years ago

@williamjameshandley

I ran the command sudo CC=/apps/openmpi/4.0.1/bin/mpicc CXX=/apps/openmpi/4.0.1/bin/mpicxx python setup.py install --install-base=/apps/polychordlite/1.16/

However, I got the following error:

running install
error: install-base or install-platbase supplied, but installation scheme is incomplete
williamjameshandley commented 4 years ago

Hi @anusurendra Did you eventually resolve this? If so, could you post the solution for future users?

anusurendra commented 4 years ago

@williamjameshandley ,

It seems that I get the following error:

I ran the command sudo CC=/apps/openmpi/4.0.1/bin/mpicc CXX=/apps/openmpi/4.0.1/bin/mpicxx python setup.py install --install-base=/apps/polychordlite/1.16/

However, I got the following error:

running install
error: install-base or install-platbase supplied, but installation scheme is incomplete
williamjameshandley commented 4 years ago

Did you try any of the other options like --prefix or --base? This is more a python installation issue, rather than a PolyChord specific one. Have you tried looking at forum posts like this

anusurendra commented 4 years ago

@williamjameshandley ,

I tried with ---prefix and got the following error:

sudo CC=/apps/openmpi/4.0.1/bin/mpicc CXX=/apps/openmpi/4.0.1/bin/mpicxx python setup.py install --prefix=/apps/polychordlite/1.16
running install
Checking .pth file support in /apps/polychordlite/1.16/lib64/python2.7/site-packages/
/bin/python -E -c pass
TEST FAILED: /apps/polychordlite/1.16/lib64/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /apps/polychordlite/1.16/lib64/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.
anusurendra commented 4 years ago

@williamjameshandley ,

I checked to make sure that PYTHONPATH was set and it is set

[root@aims ~]# echo $PYTHONPATH
/apps/polychordlite/1.16/lib64/python2.7/site-packages
[root@aims ~]# 

I have also tried changing the permissions for the directory, just in case it was an access issue. However, I am not able to fix this installation issue.

anusurendra commented 4 years ago

@williamjameshandley ,

Would you know anyone else who has installed PolyChordLite on a centos system? I am wondering because maybe they might have some insight on this issue. Thanks