Skip to content

Solving the import bug by modifying setup.py #1

@MRonaldo-gif

Description

@MRonaldo-gif

Editable install fails with ImportError: cannot import name 'INSTINCT_RL_ROOT'

At the same time, it would cause some import bug when use some scripts:

Image

(instinct-mj) myh@myh-Legion-Y7000P-IRX9:~/myh/disk-2TB/01_PAPER/InstinctMJ$ python
Python 3.13.5 (main, Jul 11 2025, 22:43:46) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.

import instinct_rl
from instinct_rl import INSTINCT_RL_ROOT
Traceback (most recent call last):
File "", line 1, in
from instinct_rl import INSTINCT_RL_ROOT
ImportError: cannot import name 'INSTINCT_RL_ROOT' from 'instinct_rl' (unknown location)

and it could be solved by modifying setup.py, just add a line:

package_dir={"": "."},

total setup.py:

`from setuptools import find_packages, setup

setup(
name="instinct_rl",
version="1.0.2",
author="Ziwen Zhuang",
author_email="",
license="BSD-3-Clause",
packages=find_packages(),
package_dir={"": "."},
description="Fast and simple RL algorithms implemented in pytorch",
python_requires=">=3.6",
install_requires=[
"torch>=2.4.0",
"torchvision>=0.5.0",
"numpy>=1.16.4",
"tensorboardX",
"tensorboard",
"tabulate",
"GitPython",
"onnx",
"onnxscript",
],
)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions