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

[BUG] python3.9 compile failure with oxpy #21

Closed
supers1x opened this issue Jul 11, 2022 · 10 comments
Closed

[BUG] python3.9 compile failure with oxpy #21

supers1x opened this issue Jul 11, 2022 · 10 comments
Assignees

Comments

@supers1x
Copy link

supers1x commented Jul 11, 2022

Describe the bug
For the latest oxDNA-3.3, fail to compile oxpy with python3.9(Anaconda3).
The old version 'oxDNA-analysis-tools-1.0.15' works just fine on my system.

To Reproduce
Steps to reproduce the behavior:

  1. cmake .. -DCUDA=ON -DPython=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DOxpySystemInstall=On
  2. make
  3. make install
Processing ./oxpy/python/oxpy
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/fsa/home/user/apps/oxDNA-3.3/build2/oxpy/python/oxpy/setup.py", line 7, in <module>
          setup(
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/__init__.py", line 86, in setup
          _install_setup_requires(attrs)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
          dist = MinimalDistribution(attrs)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/__init__.py", line 57, in __init__
          super().__init__(filtered)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/dist.py", line 460, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 996, in <genexpr>
          eps = itertools.chain.from_iterable(
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
          k = key(element)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
          return self._name_from_stem(stem) or super()._normalized_name
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
          return Prepared.normalize(self.name)
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
          return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
        File "/fsa/home/user/apps/anaconda3/lib/python3.9/re.py", line 210, in sub
          return _compile(pattern, flags).sub(repl, string, count)
      TypeError: expected string or bytes-like object
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
@supers1x supers1x added the bug Something isn't working label Jul 11, 2022
@lorenzo-rovigatti
Copy link
Owner

Hi! It looks like compilation succeeds, but installation fails.

Can you copy&paste the content of the /fsa/home/user/apps/oxDNA-3.3/build2/oxpy/python/oxpy/setup.py file?

@lorenzo-rovigatti lorenzo-rovigatti self-assigned this Jul 11, 2022
@supers1x
Copy link
Author

supers1x commented Jul 11, 2022

Thanks for the rapid response. Here are the contents of the document /fsa/home/user/apps/oxDNA-3.3/build2/oxpy/python/oxpy/setup.py

from setuptools import setup

import sys
if sys.version_info < (3,0):
    sys.exit('Error, Python < 3.0 is not supported')

setup(
    name = 'oxpy',
    use_scm_version = {
        "root": "/fsa/home/user/apps/oxDNA-3.3",
        "fallback_version": "",
        },
    setup_requires = ['setuptools_scm'],
    packages = [ 'oxpy' ],
    package_dir = {
        'oxpy': '/fsa/home/user/apps/oxDNA-3.3/build2/oxpy/python/oxpy'
    },
    package_data = {
        'oxpy': ['core.so']
    }
)

@lorenzo-rovigatti
Copy link
Owner

lorenzo-rovigatti commented Jul 11, 2022

That looks fine. Can you copy&paste the output of the cmake command? You can make a new folder (e.g. build2) and call it from there.

@supers1x
Copy link
Author

Sorry, I do not quite understand how to call a file within a folder in GitHub. But I managed to pack the build2 folder with a file cmake_command_output.txt containing the shell output of CMake. The src folder was deleted for a smaller file size.
build2.zip

@lorenzo-rovigatti
Copy link
Owner

Sorry, that was badly worded. I just needed you to post the output of the cmake command. Your zip file contains it so that's all I needed.
Everything looks fine. The behaviour you see seems to be related to what other people are experiencing in different (but similar) contexts (see here or here).

There are a few things you can try (and get back to me if any of them works!):

  1. Call pip install . from within the oxDNA root folder
  2. Edit the oxpy/make_install_setup.py and change the "fallback_version": "${fallback_release}", line to "fallback_version": "3.3",
  3. If that doesn't work add a version=3.3, line after name = oxpy,, like this:
setup(
    name = 'oxpy',
    version='3.3',
    use_scm_version = {
        "root": "${CMAKE_SOURCE_DIR}",
        "fallback_version": "3.3",
        },
    setup_requires = ['setuptools_scm'],
    packages = [ 'oxpy' ],
    package_dir = {
        'oxpy': '${OXPY_OUTPUT_DIR}'
    },
    package_data = {
        'oxpy': ['core.so']
    }
)

let me know how it goes!

@supers1x
Copy link
Author

Hi! I have tried your suggestions and they did not go well(python3.9.12). Then I switched to an older python version(3.8.13) using conda create -n python38 python=3.8, and make install run smoothly alone with oat config.

@lorenzo-rovigatti
Copy link
Owner

Thanks, that's good to know. I'll try to reproduce the issue on my machine so that I can find a way of solving it!

@ErikPoppleton
Copy link
Collaborator

ErikPoppleton commented Jul 13, 2022

Just a warning that there are a couple oat scripts that don't work with Python <3.9 because of updates to the typing library (Lorenzo, if you would rather I make it more permissive, I can remove those type checks which would make it compatible with everything >3.7). I would suggest installing it in a clean environment with a newer version of Python (I've seen reports that python 3.11 is significantly faster, but I haven't had time to test yet.)

I have installed the both oxpy and oat on fresh conda environments from 3.8 - 3.10 and all have worked for me, so it's possible that this error is coming from a conflict with something else in your environment.

That being said, doing some Googling turned up a couple possible reasons for this error:
This one and a couple others suggested that it's because of a bad .egg-info file. It might be worth looking around in your installed packages to see if you have older versions of either oxpy or oxDNA-analysis-tools floating around that you can remove.
This one suggests that it could be a problem with an OS-provided version of pip or a missplaced copy of setuptools (though this might be specific to Arch Linux and it looks like you're on a mac)

@supers1x
Copy link
Author

Hello ErikPoppleton, removing files relate to oxpy or oxDNA-analysis-tools under my Anaconda folder did help my installation.
For the record, my system is CentOS Linux release 7.3.1611.

@lorenzo-rovigatti lorenzo-rovigatti removed the bug Something isn't working label Jul 23, 2022
@lorenzo-rovigatti
Copy link
Owner

@supers1x thank you for for the feedback! I'll add this issue and its solution to our docs.

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