Trying this -->"converting YOLO V5 Ultralytics model and config format into Darknet format" # I get this error - yolov5

AttributeError Traceback (most recent call last)
in ()
4 with open(cfg_file_name, 'w') as cfg:
5 with open(yaml_file_name,'r') as f:
----> 6 f = yaml.load(f,Loader=yaml.FullLoader)
7 net = 0
8 for l in f:
AttributeError: module 'yaml' has no attribute 'FullLoader'

Installing collected packages: PyYaml
Attempting uninstall: PyYaml
Found existing installation: PyYAML 5.4.1
Uninstalling PyYAML-5.4.1:
Successfully uninstalled PyYAML-5.4.1
Successfully installed PyYaml-5.1
WARNING: You are using pip version 20.3.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
dmjang#a4000:~/work/yolov5$ python3 gen_wts_yoloV5.py -w yolov5n.pt
YOLOv5 🚀 v6.0-255-gca0a007 torch 1.10.2+cu113 CPU
Traceback (most recent call last):
File "gen_wts_yoloV5.py", line 133, in
f = yaml.load(f,Loader=yaml.FullLoader)
AttributeError: module 'yaml' has no attribute 'FullLoader'
still not solved...
Next I tried pip3 command instead pip.
so It is solved.

Related

python setup.py egg_info did not run successfully. WARNING: Ignoring invalid distribution -yaudio

I need some help please... I tried to instal pydictionary and it give me the same errors and warnings. And for anything else the Warning is the same and I can not understand why. I went to that directory to see what is in there but is empty.
C:\WINDOWS\system32>pip install PyDictionary
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
Collecting PyDictionary
Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting goslate
Using cached goslate-1.5.4.tar.gz (14 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: requests in c:\users\robi\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (2.27.1)
Requirement already satisfied: click in c:\users\robi\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (8.1.3)
Collecting bs4
Using cached bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: beautifulsoup4 in c:\users\robi\appdata\local\programs\python\python310\lib\site-packages (from bs4->PyDictionary) (4.11.1)
Requirement already satisfied: colorama in c:\users\robi\appdata\local\programs\python\python310\lib\site-packages (from click->PyDictionary) (0.4.4)
Collecting futures
Using cached futures-3.0.5.tar.gz (25 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 247, in <module>
monkey.patch_all()
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 97, in patch_all
patch_for_msvc_specialized_compiler()
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 157, in patch_for_msvc_specialized_compiler
patch_func(*msvc14('_get_vc_env'))
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 147, in patch_params
mod = import_module(mod_name)
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
import unittest.mock as mock
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\unittest\mock.py", line 26, in <module>
import asyncio
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Users\Robi\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Users\Robi\AppData\Local\Temp\pip-install-jx1giu6v\futures_b2c696095539418c98c7048813756f80\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\Robi\AppData\Local\Temp\pip-install-jx1giu6v\futures_b2c696095539418c98c7048813756f80\concurrent\futures\_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
I also tried to see my list and upgrade the setup tools but...
C:\WINDOWS\system32>pip list
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
Package Version
beautifulsoup4 4.11.1
cachetools 5.1.0
calculator1 1.0.0
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.12
click 8.1.3
colorama 0.4.4
comtypes 1.1.11
DateTime 4.4
distlib 0.3.4
ez-setup 0.9
filelock 3.7.0
Flask 2.1.2
future 0.18.2
google-api-core 2.8.0
google-api-python-client 2.48.0
google-auth 2.6.6
google-auth-httplib2 0.1.0
google-auth-oauthlib 0.5.1
googleapis-common-protos 1.56.1
gTTS 2.2.4
httplib2 0.20.4
idna 3.3
iso8601 1.0.2
itsdangerous 2.1.2
Jinja2 3.1.2
keyboard 0.13.5
MarkupSafe 2.1.1
MouseInfo 0.1.3
numpy 1.23.4
oauthlib 3.2.0
Pillow 9.1.1
pip 22.3.1
platformdirs 2.5.2
playsound 1.3.0
protobuf 3.20.1
pyAlarm 1.0.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
PyAudio 0.2.12
PyAutoGUI 0.9.53
pycparser 2.21
PyGetWindow 0.0.9
pyjokes 0.6.0
PyMsgBox 1.0.9
pyparsing 3.0.9
pyperclip 1.8.2
pypiwin32 223
PyRect 0.2.0
PyScreeze 0.1.28
pyserial 3.5
pyttsx3 2.90
pytweening 1.0.4
pytz 2022.1
pywhatkit 5.3
pywin32 304
PyYAML 6.0
requests 2.27.1
requests-oauthlib 1.3.1
rsa 4.8
scipy 1.9.3
serial 0.0.97
setuptools 65.5.1
six 1.16.0
sounddevice 0.4.4
soupsieve 2.3.2.post1
SpeechRecognition 3.8.1
uritemplate 4.1.1
urllib3 1.26.9
virtualenv 20.14.1
Werkzeug 2.1.2
wheel 0.38.4
wikipedia 1.4.0
xgboost 1.7.1
zope.interface 5.4.0
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -yaudio (c:\users\robi\appdata\local\programs\python\python310\lib\site-packages)
I tried to upgrade pip and tools in cmd but that warning is still there. I uninstall the pyaudio to see if that is the problem but still the same errors. I hope someone can help me with this problem please
I appreciate your help

cant install pygame in pycharm

First of all, I'm new to programming. So,forgive me for my mistakes. I've installed pygame in python IDLE. But when I try to install it in pycharm, this happens:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
(venv) C:\Users\ARMAN\PycharmProjects\GAMES>pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"?[Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-5f1r3j6w\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-5f1r3j6w\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-5f1r3j6w\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-5f1r3j6w\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ARMAN\AppData\Local\Temp\pip-install-5f1r3j6w\pygame\
(venv) C:\Users\ARMAN\PycharmProjects\GAMES>py -m pip install -U pygame --user
Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-nykuwxyw\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-nykuwxyw\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-nykuwxyw\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\ARMAN\AppData\Local\Temp\pip-install-nykuwxyw\pygame\buildconfig\downloa
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ARMAN\AppData\Local\T
(venv) C:\Users\ARMAN\PycharmProjects\GAMES>
I get an error. I've updated everything. Found a similar problem here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000435070-Command-python-setup-py-egg-info-failed-with-error-code-1-whatever-package-I-try-to-install-.
But I can't understand the solution. So, please kindly help me.
This isn't my answer, but an answer from here:
Pygame docs recommends that you use Python version 3.6.1 or greater,
so I would suggest you to use the most recent non-beta version. Also,
some pygame wheels are not available to this version yet.
After the python installation make sure its added to your PATH
variable and try to install Pygame using this command given that you
are on windows:
py -m pip install -U pygame --user
If you get a PermissionError then
run the command prompt as administrator.
I hope this helps.

AttributeError: '_NamespacePath' object has no attribute 'sort' on Read the docs

Pretty sure this isn't a dupe.
my read docs build fails here:
Collecting sphinxcontrib-inlinesyntaxhighlight==0.2 (from -r /home/docs/checkouts/readthedocs.org/user_builds/zproc/checkouts/latest/requirements.txt (line 33))
Using cached https://files.pythonhosted.org/packages/5c/8b/17998fe9ebbec7e176f344648a86094d7b358e63d8f4593ae3dfbb9bb560/sphinxcontrib-inlinesyntaxhighlight-0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/setuptools/__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, filterfalse, map
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3017, in <module>
#_call_aside
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3045, in _initialize_master_working_set
dist.activate(replace=False)
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2577, in activate
declare_namespace(pkg)
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2151, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2091, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/docs/checkouts/readthedocs.org/user_builds/zproc/envs/latest/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2120, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wlv3e5i4/sphinxcontrib-inlinesyntaxhighlight/
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Looks like it is failing to install sphinxcontrib-inlinesyntaxhighlight, which installs just fine in my local machine.
A simple search seems to say that it can be fixed using pip install --upgrade pip setuptools, but I don't know how to do that on read the docs.
Here is the requirements.txt i supply to read the docs
alabaster==0.7.11
Babel==2.6.0
backcall==0.1.0
certifi==2018.4.16
chardet==3.0.4
decorator==4.3.0
docutils==0.14
idna==2.7
imagesize==1.0.0
ipython==6.4.0
ipython-genutils==0.2.0
jedi==0.12.1
Jinja2==2.10
MarkupSafe==1.0
packaging==17.1
parso==0.3.0
pexpect==4.6.0
pickleshare==0.7.4
pkginfo==1.4.2
prompt-toolkit==1.0.15
psutil==5.4.6
ptyprocess==0.6.0
Pygments==2.2.0
pyparsing==2.2.0
pytz==2018.5
pyzmq==17.0.0
requests==2.19.1
requests-toolbelt==0.8.0
simplegeneric==0.8.1
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.7.5
sphinxcontrib-inlinesyntaxhighlight==0.2
sphinxcontrib-websupport==1.1.0
tblib==1.3.2
tinydb==3.9.0.post1
tqdm==4.23.4
traitlets==4.3.2
twine==1.11.0
urllib3==1.23
wcwidth==0.1.7
As suggested here. and quoting the same -
The _path_ attribute should always be treated as an interable, not a list (the Python docs describe _path_ as an iterable). The line in pkg_resources/_init_.py that reads:
orig_path.sort(key=position_in_sys_path)
Should be:
orig_path = sorted(orig_path, key=position_in_sys_path)
As a general rule (if practical), in-place sorting should not be used.
PS -
I tried upgrading pip and setuptools but it didn't work for me.
pip install -U pip
pip install -U setuptools

Getting Error while building mysql for python on Mac OS X El Capitan

I read some of the related topics and tried to implement those solutions to my situation but still I get the following error after this command :
(project2_env) Efe-MacBook-Air:MySQL-python-1.2.4b4 efe$ python setup.py build
The Error message is :
Extracting in /var/folders/rv/vbf7xqh1601_xjkrn85w7hp00000gn/T/tmpptpsggg7
Traceback (most recent call last):
File "/Users/efe/virtualenvs/downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 7, in <module>
use_setuptools()
File "/Users/efe/virtualenvs/downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/Users/efe/virtualenvs/downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 125, in _do_download
_build_egg(egg, tarball, to_dir)
File "/Users/efe/virtualenvs/downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 99, in _build_egg
_extractall(tar)
File "/Users/efe/virtualenvs/downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 486, in _extractall
self.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
Edit: I reinstalled homebrew, then I run this following command. That is successfully installed.
brew install mysql
However, I cannot still import MySQLdb in python.
As it is more complicated than the previous answer, i won't told you about the custom installation of python mysql.
Found this, the Jude's way :
Install mysql via homebrew, then you can install mysql python via pip.
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
//don't know how to install mysql via homebrew, but it should be done here
pip install MySQL-python
https://stackoverflow.com/a/25356073/6660122
Taken from the Python2 doc, still relevant in 3.5 :
"Alternate installation: the user scheme
This scheme is designed to be the most convenient solution for users that don’t have write permission to the global site-packages directory or don’t want to install into it. It is enabled with a simple option: "
python setup.py install --user
Could help in your case.
Notice there are different scheme to use : --home, or --prefix and --exec-prefix, or --install-base and --install-platbase
Finally I found a solution for myself and by myself. I gave up using directly MySQLdb library and instead of that, I installed PyMySQL. By the way I had already installed MySQL Workbench before, so mysql server was already running.
Here is what I do step by step. I hope someone can get benefit from it.
1) Create a virtual environment:
virtualenv virt1
2) Make your virtual environment activated:
source virt1/bin/activate
3) Now, you are in your virtual environment. Install PyMySQL:
pip install PyMySQL
4) Now, try whether your MySQL connection is OK or not with a simple py executable:
#!/usr/bin/python
import pymysql.cursors
# Connect to the database
connection = pymysql.connect(host='localhost',
user='YourDBuserName',
password='YourDBpassword',
db='YourDBname',
charset='utf8',
cursorclass=pymysql.cursors.DictCursor)
try:
with connection.cursor() as cursor:
# Read a single record
sql = "SELECT `id`, `name` FROM `YourTableName` WHERE `id`=%s"
cursor.execute(sql, (1,))
result = cursor.fetchone()
print(result)
finally:
connection.close()
5) You should see that your first row from the table appears on the screen.
Note: The part "import pymysql.cursors" could be tricky. First, I wrote as "import PyMySQL.cursors" and that didn't work!

Error when trying to install Django CMS in virtualenv w/ MySQL on Mac OSX

I am getting the following error when I try to install django CMS with MySQL using virutalenv:
RuntimeError: maximum recursion depth exceeded
/Users/ethan/Sites/env/build/mysql-python/distribute-0.6.28-py2.7.egg
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/Users/ethan/Sites/env/build/mysql-python/setup.py", line 7, in <module>
use_setuptools()
File "distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "distribute_setup.py", line 125, in _do_download
_build_egg(egg, tarball, to_dir)
File "distribute_setup.py", line 116, in _build_egg
raise IOError('Could not build the egg.')
IOError: Could not build the egg.
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/ethan/Sites/env/build/mysql-python
The command I am using for the install is the following:
env/bin/pip install --download-cache=~/.pip-cache -r reqs.txt
And the reqs.txt file looks like this:
django-cms==2.4.1
Django==1.5.1
django-classy-tags==0.4
South==0.8.1
html5lib==1.0b1
django-mptt==0.5.2
django-sekizai==0.7
six==1.3.0
Pillow==2.0.0
django-filer==0.9.4
cmsplugin-filer==0.9.5
django-reversion==1.7
mysql-python==1.2.4
I'm a novice to django (just going through the tutorial) and I cannot find anything in a search that seems to resolve this issue. Anyone have any ideas?
Change your requirement to mysql-python==1.2.5, I had the same problem on a CentOS 6.3 server.
mysql-python v. 1.2.4 has a hard dependency on distribute version 0.6.28. It might not be picking the right version of distribute.
Run this after the virtual env is activated:
easy_install distribute==0.6.28
and you should be good to proceed with
env/bin/pip install --download-cache=~/.pip-cache -r reqs.txt
change requirement to mysql-python==1.2.5 also worked for me on OS X mavericks with pip install