Closed bersbersbers closed 11 months ago
Hi @bersbersbers, I suspect this problem was already solved in v66.1.0.
You can see that the call to register_finder
is surrounded by an if hasattr
statement in: https://github.com/pypa/setuptools/blob/b8c0a599676a23048a9041233b423c9dfaf4b70a/pkg_resources/__init__.py#L2230-L2231
Please note that bug fixes in setuptools are published in new versions in a monotonic increasing fashion. Unfortunately we don't have the bandwidth to support older versions or backport bug fixes.
Issue still exists with Python 3.12.0b4 / pip 23.2.1 / setuptools 68.0.0
@Hoernchen that is not surprising considering that https://github.com/numpy/numpy/issues/23808 is still open. You should star that issue.
@Hoernchen that is not surprising considering that numpy/numpy#23808 is still open. You should star that issue.
You're right - I got until "I suspect this problem was already solved in v66.1.0." and didn't notice the numpy issue below, sorry for the noise.
Issue still, I had upgrade all things which need to upgrade.
(minerl) F:\Code\minerl>python -V
Python 3.12.2
(minerl) F:\Code\minerl>pip install .
Processing f:\code\minerl
Preparing metadata (setup.py) ... done
Collecting gym<=0.23.1,>=0.19.0 (from minerl==1.0.2)
Using cached gym-0.23.1.tar.gz (626 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting opencv-python>=4.1.0.25 (from minerl==1.0.2)
Using cached opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl.metadata (20 kB)
Requirement already satisfied: setuptools>=49.2.0 in d:\dev\miniconda3\envs\minerl\lib\site-packages (from minerl==1.0.2) (69.2.0)
Collecting tqdm>=4.32.2 (from minerl==1.0.2)
Using cached tqdm-4.66.2-py3-none-any.whl.metadata (57 kB)
Collecting numpy<1.24,>=1.16.2 (from minerl==1.0.2)
Downloading numpy-1.23.5.tar.gz (10.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 4.5 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "D:\Dev\miniconda3\envs\minerl\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "D:\Dev\miniconda3\envs\minerl\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\miniconda3\envs\minerl\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "D:\Dev\miniconda3\envs\minerl\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\miniconda3\envs\minerl\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\Users\iFeng\AppData\Local\Temp\pip-build-env-3wi8hs4b\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
import setuptools.version
File "C:\Users\iFeng\AppData\Local\Temp\pip-build-env-3wi8hs4b\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
import pkg_resources
File "C:\Users\iFeng\AppData\Local\Temp\pip-build-env-3wi8hs4b\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2172, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
(minerl) F:\Code\minerl>pip install setuptools
Requirement already satisfied: setuptools in d:\dev\miniconda3\envs\minerl\lib\site-packages (69.2.0)
(minerl) F:\Code\minerl>pip install setuptools -U
Requirement already satisfied: setuptools in d:\dev\miniconda3\envs\minerl\lib\site-packages (69.2.0)
(minerl) F:\Code\minerl>pip install --upgrade setuptools
Requirement already satisfied: setuptools in d:\dev\miniconda3\envs\minerl\lib\site-packages (69.2.0)
(minerl) F:\Code\minerl>python -m pip install --upgrade setuptools
Requirement already satisfied: setuptools in d:\dev\miniconda3\envs\minerl\lib\site-packages (69.2.0)
(minerl) F:\Code\minerl>conda list setuptools
# packages in environment at D:\Dev\miniconda3\envs\minerl:
#
# Name Version Build Channel
setuptools 69.2.0 pyhd8ed1ab_0 conda-forge
(minerl) F:\Code\minerl>conda upgrade setuptools
Channels:
- conda-forge
- defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done
# All requested packages already installed.
(minerl) F:\Code\minerl>python -m ensurepip --upgrade
Looking in links: c:\Users\iFeng\AppData\Local\Temp\tmpo78fro0j
Requirement already satisfied: pip in d:\dev\miniconda3\envs\minerl\lib\site-packages (24.0)
(minerl) F:\Code\minerl>
# Copyright (c) 2020 All Rights Reserved
# Author: William H. Guss, Brandon Houghton
import os
import sys
import json
from os.path import isdir
import subprocess
import pathlib
import setuptools
from setuptools import Command
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.install_lib import install_lib
from distutils.command.build import build
from setuptools.dist import Distribution
import shutil
with open("README.md", "r") as fh:
markdown = fh.read()
with open("requirements.txt", "r") as fh:
requirements = fh.read()
MALMO_BRANCH = "minerl"
MALMO_VERSION = "0.37.0"
MALMO_DIR = os.path.join(os.path.dirname(__file__), 'minerl', 'Malmo')
BINARIES_IGNORE = shutil.ignore_patterns(
'build',
'bin',
'dists',
'caches',
'native',
'.git',
'doc',
'*.lock',
'.gradle',
'.minecraftserver',
'.minecraft')
# TODO: THIS IS NOT ACTUALLY IGNORING THE GRADLE.
# TODO: Potentially add locks to the binary ignores.
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
# @minecraft_build
class bdist_wheel(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
except ImportError:
bdist_wheel = None
# https://github.com/chinmayshah99/PyDP/commit/2ddbf849a749adad5d5db10d4d7e3479567087f3
# Bug here https://github.com/python/cpython/blob/28ab3ce92402d86aa400960d38f0d69f498bb677/Lib/distutils/command/install.py#L335
# Original fix proposed here: https://github.com/google/or-tools/issues/616
class BinaryDistribution(Distribution):
"""This class is needed in order to create OS specific wheels."""
def has_ext_modules(self):
return True
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def unpack_assets():
asset_dir = os.path.join(os.path.expanduser('~'), '.gradle', 'caches', 'forge_gradle', 'assets')
output_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'minerl', 'MCP-Reborn', 'src', 'main', 'resources')
index = load_asset_index(os.path.join(asset_dir, 'indexes', '1.16.json'))
unpack_assets_impl(index, asset_dir, output_dir)
def load_asset_index(index_file):
with open(index_file) as f:
return json.load(f)
def unpack_assets_impl(index, asset_dir, output_dir):
for k, v in index['objects'].items():
asset_hash = v["hash"]
src = os.path.join(asset_dir, 'objects', asset_hash[:2], asset_hash)
dst = os.path.join(output_dir, k)
os.makedirs(os.path.dirname(dst), exist_ok=True)
shutil.copy(src, dst)
class InstallPlatlib(install):
def finalize_options(self):
install.finalize_options(self)
# Hmm so this is wierd. When is has_ext_modules tru?
if self.distribution.has_ext_modules():
self.install_lib = self.install_platlib
class InstallWithMinecraftLib(install_lib):
"""Overrides the build command in install lib to build the minecraft library
and place it in the build directory.
"""
def build(self):
super().build()
class CustomBuild(build):
def run(self):
super().run()
class ShadowInplace(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
pass
def prep_mcp():
mydir = os.path.abspath(os.path.dirname(__file__))
# First, get MCP and patch it with our source.
if os.name == 'nt':
# Windows is picky about this, too... If you have WSL, you have
# bash command, but an absolute path won't work. So lets instead
# use relative paths
old_dir = os.getcwd()
os.chdir(os.path.join(mydir, 'scripts'))
try:
setup_output = subprocess.check_output(['bash.exe', 'setup_mcp.sh']).decode(errors="ignore")
if "ERROR: JAVA_HOME" in setup_output:
raise RuntimeError(
"""
`java` and/or `javac` commands were not found by the installation script.
Make sure you have installed Java JDK 8.
On Windows, if you installed WSL/WSL2, you may need to install JDK 8 in your WSL
environment with `sudo apt update; sudo apt install openjdk-8-jdk`.
"""
)
elif "Cannot lock task history" in setup_output:
raise RuntimeError(
"""
Installation failed probably due to Java processes dangling around from previous attempts.
Try killing all Java processes in Windows and WSL (if you use it). Rebooting machine
should also work.
"""
)
subprocess.check_call(['bash.exe', 'patch_mcp.sh'])
except subprocess.CalledProcessError as e:
raise RuntimeError(
"""
Running install scripts failed. Check error logs above for more information.
If errors are about `bash` command not found, You have at least two options to fix this:
1. Install Windows Subsystem for Linux (WSL. Tested on WSL 2). Note that installation with WSL
may seem especially slow/stuck, but it is not; it is just a bit slow.
2. Install bash along some other tools. E.g., git will come with bash: https://git-scm.com/downloads .
After installation, you may have to update environment variables to include a path which contains
'bash.exe'. For above git tools, this is [installation-dir]/bin.
After installation, you should have 'bash' command in your command line/powershell.
If errors are about "could not create work tree dir...", try cloning the MineRL repository
to a different location and try installation again.
"""
)
os.chdir(old_dir)
else:
subprocess.check_call(['bash', os.path.join(mydir, 'scripts', 'setup_mcp.sh')])
subprocess.check_call(['bash', os.path.join(mydir, 'scripts', 'patch_mcp.sh')])
# Next, move onto building the MCP source
gradlew = 'gradlew.bat' if os.name == 'nt' else './gradlew'
workdir = os.path.join(mydir, 'minerl', 'MCP-Reborn')
if os.name == 'nt':
# Windows is picky about being in the right directory to run gradle
old_dir = os.getcwd()
os.chdir(workdir)
# This may fail on the first try. Try few times
n_trials = 3
for i in range(n_trials):
try:
subprocess.check_call('{} downloadAssets'.format(gradlew).split(' '), cwd=workdir)
except subprocess.CalledProcessError as e:
if i == n_trials - 1:
raise e
else:
break
unpack_assets()
subprocess.check_call('{} clean build shadowJar'.format(gradlew).split(' '), cwd=workdir)
if os.name == 'nt':
os.chdir(old_dir)
# Don't build binaries (requires Java) on readthedocs.io server.
if os.environ.get("READTHEDOCS"):
print("READTHEDOCS env var is set; performing partial package install only.")
cmdclass = {}
else:
cmdclass = {
'bdist_wheel': bdist_wheel,
'install': InstallPlatlib,
'install_lib': InstallWithMinecraftLib,
'build_malmo': CustomBuild,
'shadow_develop': ShadowInplace,
}
prep_mcp()
setuptools.setup(
name='minerl',
version=os.environ.get('MINERL_BUILD_VERSION', '1.0.2'),
description='MineRL environment and data loader for reinforcement learning from human demonstration in Minecraft',
long_description=markdown,
long_description_content_type="text/markdown",
url='http://github.com/minerllabs/minerl',
author='MineRL Labs',
author_email='minerl@andrew.cmu.edu',
license='MIT',
packages=setuptools.find_packages(exclude=['tests', 'tests.*']),
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
install_requires=requirements,
distclass=BinaryDistribution,
include_package_data=True,
cmdclass=cmdclass,
)
Issue still, I had upgrade all things. I'm trying to install NeMo ToolSuite from NVIDIA and get the same output as others
?> pip install 'nemo_toolkit[asr]'
Collecting nemo_toolkit[asr]
Using cached nemo_toolkit-1.23.0-py3-none-any.whl.metadata (18 kB)
Collecting huggingface-hub (from nemo_toolkit[asr])
Using cached huggingface_hub-0.22.2-py3-none-any.whl.metadata (12 kB)
Collecting numba (from nemo_toolkit[asr])
Using cached numba-0.59.1-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.7 kB)
Collecting numpy>=1.22 (from nemo_toolkit[asr])
Using cached numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (61 kB)
Collecting onnx>=1.7.0 (from nemo_toolkit[asr])
Using cached onnx-1.16.0-cp312-cp312-macosx_10_15_universal2.whl.metadata (16 kB)
Collecting python-dateutil (from nemo_toolkit[asr])
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting ruamel.yaml (from nemo_toolkit[asr])
Using cached ruamel.yaml-0.18.6-py3-none-any.whl.metadata (23 kB)
Collecting scikit-learn (from nemo_toolkit[asr])
Using cached scikit_learn-1.4.2-cp312-cp312-macosx_12_0_arm64.whl.metadata (11 kB)
Requirement already satisfied: setuptools>=65.5.1 in /Users/jt/Documents/Personal/Code/MVP - Nexo/env/lib/python3.12/site-packages (from nemo_toolkit[asr]) (69.5.1)
Collecting tensorboard (from nemo_toolkit[asr])
Using cached tensorboard-2.16.2-py3-none-any.whl.metadata (1.6 kB)
Collecting text-unidecode (from nemo_toolkit[asr])
Using cached text_unidecode-1.3-py2.py3-none-any.whl.metadata (2.4 kB)
Collecting torch (from nemo_toolkit[asr])
Using cached torch-2.2.2-cp312-none-macosx_11_0_arm64.whl.metadata (25 kB)
Collecting tqdm>=4.41.0 (from nemo_toolkit[asr])
Using cached tqdm-4.66.2-py3-none-any.whl.metadata (57 kB)
INFO: pip is looking at multiple versions of nemo-toolkit[asr] to determine which version is compatible with other requirements. This could take a while.
Collecting nemo_toolkit[asr]
Using cached nemo_toolkit-1.22.0-py3-none-any.whl.metadata (15 kB)
Collecting numpy<1.24,>=1.22 (from nemo_toolkit[asr])
Using cached numpy-1.23.5.tar.gz (10.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "/Users/jt/Documents/Personal/Code/MVP - Nexo/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/jt/Documents/Personal/Code/MVP - Nexo/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jt/Documents/Personal/Code/MVP - Nexo/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "/Users/jt/Documents/Personal/Code/MVP - Nexo/env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/private/var/folders/9_/z28g2c65053gzw82gs_x84h40000gn/T/pip-build-env-exnsie1a/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/private/var/folders/9_/z28g2c65053gzw82gs_x84h40000gn/T/pip-build-env-exnsie1a/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/private/var/folders/9_/z28g2c65053gzw82gs_x84h40000gn/T/pip-build-env-exnsie1a/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Please have a look on the previous comments.
This is an issue with how old versions of numpy cap setuptools
versions range in a way that don't work on Python 3.12.
Newer versions of setuptools do work on Python 3.12.
You likely need a newer version of numpy.
If your dependencies lock the version of numpy, please contact their maintainers about the problem and suggest modifying the version range so that Python 3.12 is supported.
See the numpy issue mentioned above.
I am using pip 23.1.2 on Python 3.12.0b1 via pyenv on Windows 10, and I am unable to install matplotlib or numpy:
I have done the tour via https://github.com/pypa/setuptools/issues/3631 and https://github.com/pypa/pip/issues/11688 all the way to here, which is the only issue still open.
Originally posted by @bersbersbers in https://github.com/pypa/pip/issues/11501#issuecomment-1562025923