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

Python 3 Virtualenv + Binary: Installation fails - AttributeError: module 'plistlib' has no attribute 'Dict' #322

Open
karthigb opened this issue Jul 2, 2018 · 5 comments

Comments

@karthigb
Copy link

karthigb commented Jul 2, 2018

I final step of the Python 3 Virtualenv + Binary installation instructions fails. Any thoughts as to why this is failing?

`(labelImg-c78H3X17) ➜ labelImg git:(master) ✗ python setup.py py2app -A

running py2app
Traceback (most recent call last):
File "setup.py", line 64, in
setup_requires=['py2app']
File "/Users/karthig/.local/share/virtualenvs/labelImg-c78H3X17/lib/python3.7/site-packages/setuptools/init.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 984, in run_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/Users/karthig/.local/share/virtualenvs/labelImg-c78H3X17/lib/python3.7/site-packages/py2app/build_app.py", line 614, in finalize_options
if isinstance(self.plist, plistlib.Dict):
AttributeError: module 'plistlib' has no attribute 'Dict'`

  • OS:
  • PyQt version:
@vdalv
Copy link
Contributor

vdalv commented Jul 4, 2018

It might be due to your version of Python. Personally, I've only tested labelImg w/ v3.6 and v2.7. However, this installation process is known to be buggy (#321) so I'd recommend just running it from source using the 'Python 3 + Qt5' instructions here.

@karthigb
Copy link
Author

karthigb commented Jul 5, 2018

You're right. I was using Python 3.7. I managed to get it working by using PyPy.

@bjce
Copy link

bjce commented Feb 23, 2019

I had a similar issue with the following description:

I have an application in a python script my_app.py and want to make a standalone executable out of it on a MacOS (10.14). Following the video-tutorial here, I entered sequentially the following commmands:

pip install virtualenv
virtualenv venv --system-site-packages
source venv/bin/activate
pip install py2app
cd /path/to/my_app.py
python setup.py py2app -A

with the following setup.py file:

from setuptools import setup

APP = ["my_app.py"]
DATA_FILES = []
OPTIONS = {
    "argv_emulation": True,
    "packages": ["certifi"],
}
setup(
    app = APP,
    data_files = DATA_FILES,
    options = {"py2app": OPTIONS},
    setup_requires = ["py2app"]

)

but got the following error message:

Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    setup_requires = ["py2app"]
  File "/Users/mymac/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/Users/mymac/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/mymac/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/mymac/anaconda3/lib/python3.7/distutils/dist.py", line 984, in run_command
    cmd_obj.ensure_finalized()
  File "/Users/mymac/anaconda3/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/Users/mymac/venv/lib/python3.7/site-packages/py2app/build_app.py", line 567, in finalize_options
    if isinstance(self.plist, plistlib.Dict):
AttributeError: module 'plistlib' has no attribute 'Dict'

I tried to to follow the commands on the github page mentioned by @vdalv and typed the following code:

brew install qt  # will install qt-5.x.x
brew install libxml2
make qt5py3
python3 labelImg.py
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

As a side note, if mssing pyrcc5 or lxml, try
pip3 install pyqt5 lxml

However after entering the line make qt5py3, I get:

make: *** No rule to make target `qt5py3'.  Stop.

I also tried the following commands:

brew install python3
pip install pipenv
pipenv --three
pipenv shell
pip install py2app
pip install PyQt5 lxml
make qt5py3
rm -rf build dist
python setup.py py2app -A
mv "dist/labelImg.app" /Applications

But also got

make: *** No rule to make target `qt5py3'.  Stop.

after entering the line make qt5py3

What am I doing wrong?

@bjce
Copy link

bjce commented Feb 24, 2019

ok in the meantime, I got an answer that worked for me:

instead of

pip install py2app

write

pip3.7 install -U py2app

@vicgaray
Copy link

this worked for me

using python==3.7, had to use py2app==0.19

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

4 participants