简体   繁体   中英

Installing FSPS raises error in spite of environment variable being set

I am trying to install the fsps library with pip. I am using Python 3.7.5 and pip 19.3.1 on Fedora 30. I have installed FSPS following the instructions here , and numpy is installed. But when I run

pip3 install fsps

I get the following error

Collecting fsps
  Using cached https://files.pythonhosted.org/packages/3d/4f/3491667b60f9e202bf755c18e6e03048bd003c4b9b33dd832c446171d940/fsps-0.2.2.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-smda6ikh/fsps/setup.py'"'"'; __file__='"'"'/tmp/pip-install-smda6ikh/fsps/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-smda6ikh/fsps/pip-egg-info
         cwd: /tmp/pip-install-smda6ikh/fsps/
    Complete output (16 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-smda6ikh/fsps/fsps/__init__.py", line 26, in <module>
        ev = os.environ["SPS_HOME"]
      File "/usr/lib64/python3.7/os.py", line 679, in __getitem__
        raise KeyError(key) from None
    KeyError: 'SPS_HOME'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-smda6ikh/fsps/setup.py", line 87, in <module>
        from fsps import __version__  # NOQA
      File "/tmp/pip-install-smda6ikh/fsps/fsps/__init__.py", line 28, in <module>
        raise ImportError("You need to have the SPS_HOME environment variable")
    ImportError: You need to have the SPS_HOME environment variable
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I did add SPS_HOME=/path/to/fsps/ and export SPS_HOME to my .bashrc , and the compiled .o and .mod files are in ${SPS_HOME}/src . echo $SPS_HOME does show the path.


I tried to install from source . Running

git clone https://github.com/dfm/python-fsps.git
cd python-fsps
python setup.py install

raises the same kind of error

Traceback (most recent call last):
  File "/home/user/python-fsps/fsps/__init__.py", line 26, in <module>
    ev = os.environ["SPS_HOME"]
  File "/usr/lib64/python3.7/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'SPS_HOME'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 87, in <module>
    from fsps import __version__  # NOQA
  File "/home/user/python-fsps/fsps/__init__.py", line 28, in <module>
    raise ImportError("You need to have the SPS_HOME environment variable")
ImportError: You need to have the SPS_HOME environment variable

How can I solve this error and install FSPS?

I did add SPS_HOME=/path/to/fsps/ to my .bashrc

Environment variables should be added to ~/.bash_profile (though ~/.bashrc is also tolerable).

For environment variables to be visible in subprocesses you must export them. Add this after setting the variable:

export SPS_HOME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM