jakev / pyxamstore

Python utility for parsing Xamarin AssemblyStore blob files
135 stars 28 forks source link

ImportError: No module named setuptools #10

Open jamalibr opened 8 months ago

jamalibr commented 8 months ago

I am trying to reverse engineering my Xamarin Forms project built APK,

I followed the below initial installing script in my Windows machine

python setup.py install

C:\Users\syed\reverse engg\pyxamstore-master\pyxamstore-master>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup
ImportError: No module named setuptools

even I tried with my MAC machine which I have python 3.12.0 installed

syed@MY-MAC pyxamstore-master % python3 setup.py install

Traceback (most recent call last):
  File "/Users/syed/Documents/reverse engineer/pyxamstore-master/setup.py", line 4, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
rob-X1 commented 8 months ago

Have you tried pip3 install setuptools?

jamalibr commented 8 months ago

@rob-X1 I tried pip3 install setuptools command as you mentioned and setuptools-69.0.3 got installed successfully. after that I tried python3 setup.py install command and it showed following error error: Could not find suitable distribution for Requirement.parse('xxhash==3.2.0') even though it showed error for python3 setup.py install command I tired next command pyxamstore unpack -d assemblies/ it showed below message

  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyxamstore-1.0.0-py3.12.egg/pyxamstore/explorer.py", line 13, in <module>
ModuleNotFoundError: No module named 'lz4'

I am adding my complete terminal window commands and response for your reference.

syed@MY-MAC pyxamstore-master % pip3 install setuptools

Collecting setuptools
  Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/55/3a/5121b58b578a598b269537e09a316ad2a94fdd561a2c6eb75cd68578cc6b/setuptools-69.0.3-py3-none-any.whl.metadata
  Downloading setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB)
Downloading setuptools-69.0.3-py3-none-any.whl (819 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.5/819.5 kB 2.5 MB/s eta 0:00:00
Installing collected packages: setuptools
Successfully installed setuptools-69.0.3

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: pip3 install --upgrade pip

syed@MY-MAC pyxamstore-master % python3 setup.py install

running install
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
running bdist_egg
running egg_info
creating pyxamstore.egg-info
writing pyxamstore.egg-info/PKG-INFO
writing dependency_links to pyxamstore.egg-info/dependency_links.txt
writing entry points to pyxamstore.egg-info/entry_points.txt
writing requirements to pyxamstore.egg-info/requires.txt
writing top-level names to pyxamstore.egg-info/top_level.txt
writing manifest file 'pyxamstore.egg-info/SOURCES.txt'
reading manifest file 'pyxamstore.egg-info/SOURCES.txt'
writing manifest file 'pyxamstore.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-universal2/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/pyxamstore
copying pyxamstore/constants.py -> build/lib/pyxamstore
copying pyxamstore/__init__.py -> build/lib/pyxamstore
copying pyxamstore/explorer.py -> build/lib/pyxamstore
creating build/bdist.macosx-10.9-universal2
creating build/bdist.macosx-10.9-universal2/egg
creating build/bdist.macosx-10.9-universal2/egg/pyxamstore
copying build/lib/pyxamstore/constants.py -> build/bdist.macosx-10.9-universal2/egg/pyxamstore
copying build/lib/pyxamstore/__init__.py -> build/bdist.macosx-10.9-universal2/egg/pyxamstore
copying build/lib/pyxamstore/explorer.py -> build/bdist.macosx-10.9-universal2/egg/pyxamstore
byte-compiling build/bdist.macosx-10.9-universal2/egg/pyxamstore/constants.py to constants.cpython-312.pyc
byte-compiling build/bdist.macosx-10.9-universal2/egg/pyxamstore/__init__.py to __init__.cpython-312.pyc
byte-compiling build/bdist.macosx-10.9-universal2/egg/pyxamstore/explorer.py to explorer.cpython-312.pyc
creating build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/PKG-INFO -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/SOURCES.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/dependency_links.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/entry_points.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/requires.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying pyxamstore.egg-info/top_level.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/pyxamstore-1.0.0-py3.12.egg' and adding 'build/bdist.macosx-10.9-universal2/egg' to it
removing 'build/bdist.macosx-10.9-universal2/egg' (and everything under it)
Processing pyxamstore-1.0.0-py3.12.egg
Copying pyxamstore-1.0.0-py3.12.egg to /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages
Adding pyxamstore 1.0.0 to easy-install.pth file
Installing pyxamstore script to /Library/Frameworks/Python.framework/Versions/3.12/bin

Installed /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyxamstore-1.0.0-py3.12.egg
Processing dependencies for pyxamstore==1.0.0
Searching for xxhash==3.2.0
Reading https://pypi.org/simple/xxhash/
Download error on https://pypi.org/simple/xxhash/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) -- Some packages may not be found!
Couldn't find index page for 'xxhash' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000) -- Some packages may not be found!
No local packages or working download links found for xxhash==3.2.0
error: Could not find suitable distribution for Requirement.parse('xxhash==3.2.0')

syed@MY-MAC pyxamstore-master % pyxamstore unpack -d assemblies/

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/pyxamstore", line 33, in <module>
    sys.exit(load_entry_point('pyxamstore==1.0.0', 'console_scripts', 'pyxamstore')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/pyxamstore", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/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 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyxamstore-1.0.0-py3.12.egg/pyxamstore/explorer.py", line 13, in <module>
ModuleNotFoundError: No module named 'lz4'     
rob-X1 commented 8 months ago

It seems like your python version on your CPU platform is a bit too new to get certain packages in the version specified in requirements.txt of pyxamstore.

You can try to manually edit requirements.txt and change the version of xxhash and lz4 (see https://pypi.org what versions are available).

To avoid conflicts with other Python software installed I strongly recommend to crate a separate venv for pyxamstore.

Or you use an older Python version. Nobody forces you to use the latest Python version.

jamalibr commented 8 months ago

@rob-X1 now I am trying with my windows machine which has python 2.7.3

I am getting below ImportError

C:\Users\syed\reverse engg\pyxamstore-master\pyxamstore-master>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup
ImportError: No module named setuptools

I used the pip3 install setuptools command and evenpip install setuptools too. both commands are responding as below

C:\Users\syed\reverse engg\pyxamstore-master\pyxamstore-master>pip3 install setuptools
'pip3' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\syed\reverse engg\pyxamstore-master\pyxamstore-master>pip install setuptools
'pip' is not recognized as an internal or external command,
operable program or batch file.

I have looked the C:\Python27\Tools\Scripts folder mentioned location as well. there is no pip.exe

rob-X1 commented 8 months ago

pip3 refers to pip of Python3. If you are running Python2, then pip3 will, of course not work.

BTW. Wen I was talking about not using the latest Python version I was thinking about a still supported version like Python 3.9, 3.10 or 3.11 not the outdated deprecated abandoned version Python 2.x.

Michal-MK commented 6 months ago

Reporting the same for M2 Mac Python 3.12 and latest xxHash available. When I install the dependencies manually it works but the py setup.py install fails.

cAttte commented 4 months ago

the readme does say that python 3 is not supported (though it could be more visible...). either way i tried with 2.7.18 and it still doesn't work!