Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

ImportError: cannot import name '_split_env' from 'tox.config' #161

Closed
deepaksibm opened this issue Dec 25, 2022 · 5 comments
Closed

ImportError: cannot import name '_split_env' from 'tox.config' #161

deepaksibm opened this issue Dec 25, 2022 · 5 comments

Comments

@deepaksibm
Copy link

deepaksibm commented Dec 25, 2022

Getting below error when i run tox with travis.


language: python

dist: xenial

cache: pip

notifications:
  email: true

matrix:
  include:
    - python: 3.7
    - python: 3.8
    - python: 3.9

before_install:
- npm install npm@latest -g
- sudo apt-get update
- sudo apt-get install pandoc
- pip install pypandoc


install:
- pip install tox-travis

script: tox


Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.9.15/bin/tox", line 8, in <module>
    sys.exit(run())
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/run.py", line 38, in main
    state = setup_state(args)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/run.py", line 53, in setup_state
    options = get_options(*args)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/config/cli/parse.py", line 38, in get_options
    guess_verbosity, log_handler, source = _get_base(args)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/config/cli/parse.py", line 61, in _get_base
    MANAGER.load_plugins(source.path)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/plugin/manager.py", line 90, in load_plugins
    self._register_plugins(inline)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/plugin/manager.py", line 38, in _register_plugins
    self.manager.load_setuptools_entrypoints(NAME)
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/opt/python/3.9.15/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox_travis/hooks.py", line 6, in <module>
    from .envlist import (
  File "/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox_travis/envlist.py", line 10, in <module>
    from tox.config import _split_env as split_env
ImportError: cannot import name '_split_env' from 'tox.config' (/home/travis/virtualenv/python3.9.15/lib/python3.9/site-packages/tox/config/__init__.py)
The command "tox" exited with 1.

@gaborbernat
Copy link
Member

Tox 4 is not supported.

@deepaksibm
Copy link
Author

@gaborbernat could you please elaborate?

@ryanhiebert
Copy link
Collaborator

@deepaksibm This package depends on some implementation details that changed with tox 4, so is only compatible with tox<4. I have a PR to make non-support for tox 4 explicit, but there are some administrative hurdles that are stopping me from being able to merge and release that at this time. #160

@deepaksibm
Copy link
Author

@deepaksibm This package depends on some implementation details that changed with tox 4, so is only compatible with tox<4. I have a PR to make non-support for tox 4 explicit, but there are some administrative hurdles that are stopping me from being able to merge and release that at this time. #160

@gaborbernat is there any work around ? this script was working earlier and suddenly stopped working. Should i consider using lower versions of tox?

@ryanhiebert
Copy link
Collaborator

Yes, install tox<4 when you install. For example, with pip, you could run

pip install 'tox<4'

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

No branches or pull requests

3 participants