ma1co / Sony-PMCA-RE

Reverse Engineering Sony Digital Cameras
MIT License
2.04k stars 227 forks source link

I run into a problem on Linux when I try to run the .py file #285

Open InTarDavid opened 2 years ago

InTarDavid commented 2 years ago

image

domifi commented 2 years ago

It seems you have not installed the required modules. Install them using this command and the try again: python3 -m pip install -r requirements.txt

karenmcd commented 2 years ago

I am having the same issue.

~ pwd
/home/karen/sony-pmca/Sony-PMCA-RE
    ~/s/Sony-PMCA-RE    master  ./pmca-console.py                                     ✔ 
Traceback (most recent call last):
  File "/home/karen/sony-pmca/Sony-PMCA-RE/./pmca-console.py", line 6, in <module>
    from pmca.commands.usb import *
  File "/home/karen/sony-pmca/Sony-PMCA-RE/pmca/commands/usb.py", line 11, in <module>
    from ..apk import *
  File "/home/karen/sony-pmca/Sony-PMCA-RE/pmca/apk/__init__.py", line 1, in <module>
    from axmlparserpy.axmlprinter import AXMLPrinter
ModuleNotFoundError: No module named 'axmlparserpy'

But I have axmlparserpy:

   ~/s/Sony-PMCA-RE    master  yay -Q python-pyaxmlparser                          1 ✘ 
python-pyaxmlparser 0.3.26-2
    ~/s/Sony-PMCA-RE    master  yay -Syyu python-pyaxmlparser                         ✔ 
[sudo] password for karen: 
:: Synchronizing package databases...
 core                          165.2 KiB   463 KiB/s 00:00 [###############################] 100%
 extra                        1850.5 KiB  5.83 MiB/s 00:00 [###############################] 100%
 community                       7.1 MiB  30.2 MiB/s 00:00 [###############################] 100%
 multilib                      178.8 KiB  2.91 MiB/s 00:00 [###############################] 100%
:: Starting full system upgrade...
 there is nothing to do
:: Searching databases for updates...
:: Searching AUR for updates...
 -> Flagged Out Of Date AUR Packages:  davinci-resolve
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  python-pyaxmlparser-0.3.26-2

:: (1/1) Downloaded PKGBUILD: python-pyaxmlparser
  1 python-pyaxmlparser                      (Installed) (Build Files Exist)

Also, I have the usb module as well,


    ~/s/Sony-PMCA-RE    master  pacman -Q python-pyusb                              1 ✘ 
python-pyusb 1.2.1-3
    ~/s/Sony-PMCA-RE    master  sudo pacman -Syyu python-pyusb                      1 ✘ 
:: Synchronizing package databases...
 core                          165.2 KiB   416 KiB/s 00:00 [###############################] 100%
 extra                        1850.5 KiB  6.95 MiB/s 00:00 [###############################] 100%
 community                       7.1 MiB  33.7 MiB/s 00:00 [###############################] 100%
 multilib                      178.8 KiB  3.12 MiB/s 00:00 [###############################] 100%
warning: python-pyusb-1.2.1-3 is up to date -- reinstalling
karenmcd commented 2 years ago

https://wiki.archlinux.org/title/Python/Virtual_environment https://wiki.archlinux.org/title/Python#Package_management

These links from https://archived.forum.manjaro.org/t/screwed-my-python-install-i-think-by-installing-python-packages-with-sudo-no-venv/150875/2 this post seem relevant, but I'm still a user and would need the readme updated to tell me how to install the prerequisites properly to get this working in a "pyvenv" <---whatever that means :p

karenmcd commented 2 years ago

install these 3 in manjaro via pacman or pamac

python-virtualenv (20.11.0-1) python-importlib-metadata (4.8.1-3) python-zipp (3.8.1-1)

then run the script / or manually type each of the lines found here: https://github.com/ma1co/Sony-PMCA-RE/issues/230

Now I get this result:

   ~/sony-pmca  ./pmca-gui.py                                                 ✔  sony-pmca  
Traceback (most recent call last):
  File "./pmca-gui.py", line 12, in <module>
    from pmca.ui import *
  File "/home/karen/sony-pmca/pmca/ui/__init__.py", line 5, in <module>
    from tkinter import *
  File "/home/karen/sony-pmca/Python387bin/lib/python3.8/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

but when I run

python -m tkinter

I get a window pop-up that says "tk", This is Tcl/Tk version 8.6, This should be a cedilla: (c with s under it) - [[[[Click me!]]]] - QUIT

domifi commented 2 years ago

When installing the Python module from the distro package manager I am not really sure where they land and they may quite possibly be installed for a Python version other than your default. Using a virtualenv can be a solution and will probably work. A Python virtual environment is a way to install Python modules independently from your main Python installation.

Start off with a fresh shell session.

If you want to use this repo with a virtualenv, clone it and change into it:

$ git clone https://github.com/ma1co/Sony-PMCA-RE.git
$ cd Sony-PMCA-RE

Make sure you have Python, Pip and Virtualenv installed. You also need tk if you want to use the gui: (For distros other than arch, you need to find the appropriate command)

$ sudo pacman -S python python-pip python-virtualenv tk    # tk is optional

Now create a virtual environment in venv:

$ python -m virtualenv venv

To use the virtualenv you need to activate it. This sets some environment variables to point your python installation to this venv, instead of to your system installation. The virtualenv will stay activated until you close this shell session:

$ source venv/bin/activate

Now you can install the modules from the requirements file:

$ python -m pip install -r requirements.txt

Everything should be set up now and you should be able to either start the command line tool or use the gui:

$ python pmca-console.py    # to start the cli tool
$ python pmca-gui.py        # to start the gui

You need to keep in mind, that every time you want to use the program, you need to activate the virtualenv first.