MinshuG / pyUE4Parse

ue4 asset parser/reader
MIT License
47 stars 16 forks source link

Issue with python 3.12.3 - ModuleNotFoundError: No module named 'distutils' #20

Open joric opened 6 months ago

joric commented 6 months ago

Running python -m pip install git+https://github.com/MinshuG/pyUE4Parse.git results in this: ModuleNotFoundError: No module named 'distutils' It appears that python 3.12 removed distutils, see stackoverflow: https://stackoverflow.com/questions/77247893/modulenotfounderror-no-module-named-distutils-in-python-3-12 pip install --upgrade setuptools doesn't help either. How to install it on python 3.12?

joric commented 6 months ago

OK this allowed me to build on 3.12. You may re-check new toml properties in the new setuptools because it gave me hell.

diff --git a/pyproject.toml b/pyproject.toml
index 8b61abb..4d6e5a5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,21 +2,31 @@
 name = "UE4Parse"
 description = "ue4/5 asset parser"
 authors = [
-    "MinshuG"
+    {name = "MinshuG"}
 ]
-license = "MIT"
+license = {text = "MIT"}
 readme = "README.md"
-python = "^3.8"
-homepage = "https://github.com/MinshuG/pyUE4Parse"
-repository = "https://github.com/MinshuG/pyUE4Parse"
-
+requires-python = ">=3.8"
 keywords = ["UE4", "UE5", "Unreal Engine"]
+dynamic = ["version"]

 classifiers = [
     "Programming Language :: Python :: 3",
     'License :: OSI Approved :: MIT License'
 ]

+dependencies = [
+  "pycryptodome",
+  "lz4",
+  "pyUsmap",
+  "pillow",
+  "quicktex"
+]
+
+[project.urls]
+Homepage = "https://github.com/MinshuG/pyUE4Parse"
+Repository = "https://github.com/MinshuG/pyUE4Parse"
+
 [build-system]
-requires = ["setuptools~=56.0.0", "Cython~=3.0a5"]
+requires = ["setuptools>=61.0", "Cython~=3.0a5"]
 build-backend = "setuptools.build_meta"

And then install the module from the repo directory:

pip install .

Note dependencies moved to toml, and it completely ignores setup.py now. I wasn't able to install astc_decomp (looks like it suffers the same 3.12 issue) but I didn't really need it.

I use it in my project, https://github.com/joric/supraland I had to rewind the master 7 commits back because it was incompatible with my scripts (hierarchy changed somehow and I keep getting zero coordinates), so I had to freeze my fork (https://github.com/joric/pyUE4Parse) at 5e0e6f0. Couldn't really figure out what happened, it's pretty complicated.

MinshuG commented 6 months ago

try now it should work

joric commented 6 months ago

DOES NOT work with python -m pip install git+https://github.com/MinshuG/pyUE4Parse.git[tex] says Repository not found. Windows 11, python 3.12.3, pip 24.0. You may ditch the [tex] thing, astc_decomp_faster works in 3.12 so it doesn't have to be optional. Tried pip install .[tex] with 3.12 on a local copy, no errors. I've fixed my thing with outer refs, figures new version doesn't use ":" notation anymore.

teaishealthy commented 6 months ago

@joric try:

pip install -e "UE4Parse[tex] @ git+https://github.com/MinshuG/pyUE4Parse.git"
joric commented 6 months ago

@teaishealthy

pip install -e "UE4Parse[tex] @ git+https://github.com/MinshuG/pyUE4Parse.git"

ERROR: UE4Parse[tex] @ git+https://github.com/MinshuG/pyUE4Parse.git is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

It really hates "-e" for some reason. This works (you have to specify package name):

pip install UE4Parse[tex]@git+https://github.com/MinshuG/pyUE4Parse.git

I don't really like optional dependencies here. Maybe don't make textures optional? I'd rather just do:

pip install git+https://github.com/MinshuG/pyUE4Parse.git

@MinshuG maybe at least fix readme then, since [tex] in the end doesn't work?

joric commented 5 months ago

@MinshuG readme is wrong, the [tex] part should go before the repository address and with a module name:

pip install UE4Parse[tex]@git+https://github.com/MinshuG/pyUE4Parse.git // with texture decoders

If anyone needs to freeze at commit number (there was a breaking change in outer nodes after 5e0e6f0) it goes in the end:

pip install UE4Parse[tex]@git+https://github.com/MinshuG/pyUE4Parse.git@90e309b

But I'd rather just get rid of optional dependencies and include them into the base dependencies.