Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install the latest version vamb 4.1.4 #353

Open
neptuneyt opened this issue Aug 19, 2024 · 5 comments
Open

How to install the latest version vamb 4.1.4 #353

neptuneyt opened this issue Aug 19, 2024 · 5 comments

Comments

@neptuneyt
Copy link

Dear VAMB team,
Thanks for your outstanding work. I am tring to install the latest version vamb 4.1.4 to solve the "unmapped assembly header with bam file". The log is below, and I got the error of " Failed to build installable wheels for some pyproject.toml based projects (vamb)".

  • command
$ mamba create -n vamb4
$ conda activate vamb4
# clone the desired branch from the repository, here master
$ git clone https://github.com/RasmussenLab/vamb -b master
$ cd vamb #
$ (vamb) $ head vamb.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: vamb
Version: 4.1.4.dev132+gc923347
Requires-Python: <3.13,>=3.9.0

$ pip install -e .
  • log
Obtaining file:///data/users/Software/vamb
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: numpy==1.26.4 in /users (from vamb==4.1.4.dev132+gc923347) (1.26.4)
Collecting torch==2.3.1 (from vamb==4.1.4.dev132+gc923347)
  Downloading torch-2.3.1-cp312-cp312-manylinux1_x86_64.whl.metadata (26 kB)
Collecting pycoverm==0.6.0 (from vamb==4.1.4.dev132+gc923347)
...
Building wheels for collected packages: vamb, dadaptation
  Building editable for vamb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for vamb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [113 lines of output]
Failed to build vamb
ERROR: Could not build wheels for vamb, which is required to install pyproject.toml-based projects

I am looking forward your reply.

@shiraz-shah
Copy link

shiraz-shah commented Aug 21, 2024

We were able to successfully install the latest vamb like so:

conda create -n vamb4
conda activate vamb4
conda install pip
git clone https://github.com/RasmussenLab/vamb -b master
cd vamb
git checkout 7dc2f98
pip install -e .

In our experience, some of VAMB's dependencies like cuda can fail installing on certain systems due to gcc version differences etc. When installation failed for us on one system, we tried a different system and it worked there.

@neptuneyt
Copy link
Author

Thanks for your reply in time. But it still falied follwed by your construction on two linux systems. Log as below:

Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Downloading nvidia_nvjitlink_cu12-12.6.20-py3-none-manylinux2014_x86_64.whl (19.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.7/19.7 MB 2.2 MB/s eta 0:00:00
Building wheels for collected packages: vamb, dadaptation
  Building editable for vamb (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for vamb (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [113 lines of output]
      WARNING setuptools_scm.git git too old -> timestamp is '%cI'
      running editable_wheel
      creating /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info
      writing /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/dependency_links.txt
      writing entry points to /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/entry_points.txt
      writing requirements to /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb-4.1.4.dev121+g7dc2f98.dist-info'
      creating /tmp/pip-wheel-2d1tgleb/.tmp-9wc8c4pa/vamb-4.1.4.dev121+g7dc2f98.dist-info/WHEEL
      running build_py
      running build_ext
      Compiling src/_vambtools.pyx because it changed.
      [1/1] Cythonizing src/_vambtools.pyx
      building 'vamb._vambtools' extension
      creating /tmp/tmp4i2ywy5l.build-temp/src
      gcc -pthread -B /datanode02/Software/Miniconda3/envs/vamb4/compiler_compat -fno-strict-overflow -Wsi gn-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /datanode02/Software/Miniconda3/envs/vamb4/include -fPIC  -O2 -isystem /datanode02/Software/Miniconda3/envs/vamb4/include -fPIC -I/datanode02/Software/Miniconda 3/envs/vamb4/include/python3.12 -c src/_vambtools.c -o /tmp/tmp4i2ywy5l.build-temp/src/_vambtools.o
      In file included from src/_vambtools.c:25147:0:
      /datanode02/Software/Miniconda3/envs/vamb4/include/python3.12/internal/pycore_frame.h: 在函数‘_PyFra me_Initialize’中:
      /datanode02/Software/Miniconda3/envs/vamb4/include/python3.12/internal/pycore_frame.h:134:5: 错误: 只允许在 C99 模式下使用‘for’循环初始化声明
           for (int i = null_locals_from; i < code->co_nlocalsplus; i++) {
           ^
      /datanode02/yut/Software/Miniconda3/envs/vamb4/include/python3.12/internal/pycore_frame.h:134:5: 附注: 使用 -std=c99 或 -std=gnu99 来编译您的代码
      Traceback (most recent call last):
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/spawn.py" , line 71, in spawn
          subprocess.check_call(cmd, env=_inject_macos_ver(env))
        File "/datanode02//Software/Miniconda3/envs/vamb4/lib/python3.12/subprocess.py", line 413, in check _call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/usr/bin/gcc', '-pthread', '-B', '/datanode02//Software/Min iconda3/envs/vamb4/compiler_compat', '-fno-strict-overflow', '-Wsign-compare', '-DNDEBUG', '-O2', '-Wall', '-f PIC', '-O2', '-isystem', '/datanode02//Software/Miniconda3/envs/vamb4/include', '-fPIC', '-O2', '-isystem',  '/datanode02//Software/Miniconda3/envs/vamb4/include', '-fPIC', '-I/datanode02//Software/Miniconda3/env s/vamb4/include/python3.12', '-c', 'src/_vambtools.c', '-o', '/tmp/tmp4i2ywy5l.build-temp/src/_vambtools.o']'  returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccomp iler.py", line 191, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler .py", line 1044, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/spawn.py" , line 77, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/editable_whe el.py", line 153, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/editable_whe el.py", line 355, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/editable_whe el.py", line 278, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/editable_whe el.py", line 305, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py",  line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 974,  in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py",  line 989, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/build_ext.py ", line 93, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/b uild_ext.py", line 359, in run
          self.build_extensions()
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/b uild_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/b uild_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/command/build_ext.py ", line 254, in build_extension
          _build_ext.build_extension(self, ext)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/Cython/Distutils/build_ext.py",  line 135, in build_extension
          super(build_ext, self).build_extension(ext)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/b uild_ext.py", line 560, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler .py", line 605, in compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccomp iler.py", line 193, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
      /tmp/pip-build-env-skiw4wri/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py:989: _Deb uggingTips: Problem in editable installation.
      !!

              ********************************************************************************
              An error happened while installing `vamb` in editable mode.

              The following steps are recommended to help debug this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************

      !!
        cmd_obj.run()
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for vamb
  Building wheel for dadaptation (pyproject.toml) ... done
  Created wheel for dadaptation: filename=dadaptation-3.2-py3-none-any.whl size=23208 sha256=acb19dfd2b9fe2d89 dd43a0a8314770f52976c880315ef7afc13ee9cd018ebbd
  Stored in directory: /datanode02//.cache/pip/wheels/af/54/31/9e46a4e0b693a3c86921440efade051498d906826b16 8f5563
Successfully built dadaptation
Failed to build vamb
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (vamb)

@jakobnissen
Copy link
Member

This appears to be an error in GCC. We have previously experienced that an activate Conda environment can hijack the system's GCC and/or linker.
I don't have a good solution to this - I don't even understand thoroughly whose responsibility is it in the supply chain to ensure the correct GCC on the system. Presumably the Cython package, which does the compilation?

Anyway, try to add a newer version of GCC to the environment and see if that helps.

@shiraz-shah
Copy link

If your HPC platform allows for the loading of an alternate GCC version, then doing that first will solve the problem. In our case, this worked:
module load gcc/13.2.0

Then:

conda create -n vamb4
conda activate vamb4
conda install pip
git clone https://github.com/RasmussenLab/vamb -b master
cd vamb
git checkout 7dc2f98
pip install -e .

Alternatively, in our experience GCC 11.4.0 and 13.2.0 worked fine, while 4.8.5 did not. Check your gcc version like so:
gcc -v

@neptuneyt
Copy link
Author

Thanks for your help @jakobnissen @shiraz-shah . Finally it works followed by your construction as below:

conda activate vamb4
mamba install -c conda-forge  gcc=11.4.0
pip install -e .

Recording it for anyone may encouter this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants