MySQL 5.5. installation on Windows doesn't show up in the registry properly - windows

I am trying to get Django with MySQL working on my Windows 7 machine.
I need mySQLDB interface for this. When I try to install "mySQLDB interface", it looks for the MySQL installation in HKEY_LOCAL_MACHINE.
But in my registry it shows up in HKEY_CURRENT_USER/SOFTWARE/MySQL AB/MySQL Server 5.5.
My SQL instance seems to work fine.
MySQLDB installer somehow needs this in HKEY_LOCAL_MACHINE (I think) as it doesn't let me finish the install. It throws me this error.
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\Blah\Software\MySQL-python-1.2.3\setup_windows.
py", line 8, in get_config
mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
WindowsError: [Error 2] The system cannot find the file specified
Thanks a lot for your time.

You can fix the registry key in site.cfg. Or you can download a Windows MSI package from SourceForge. (No, it did not exist when the question was posted.)

Related

OSError: [WinError 87] The parameter is incorrect: Jupyter & Anaconda

I am using Jupyter notebooks via anaconda. When saving a new notebook to a specific directory, the whole directory becomes inaccessible, showing this error (image and text below). Other directories and the notebooks inside them are still accessible and able to be run. I am able to save new notebooks and run them in other directories no problem.
Error:
Server error: Traceback (most recent call last): File "C:\Users\u1252652.conda\envs\DS011_loss_ratio\lib\site-packages\tornado\web.py", line 1704, in _execute result = await result File "C:\Users\u1252652.conda\envs\DS011_loss_ratio\lib\site-packages\tornado\gen.py", line 234, in wrapper yielded = ctx_run(next, result) File "C:\Users\u1252652.conda\envs\DS011_loss_ratio\lib\site-packages\notebook\services\contents\handlers.py", line 116, in get model = yield maybe_future(self.contents_manager.get( File "C:\Users\u1252652.conda\envs\DS011_loss_ratio\lib\site-packages\notebook\services\contents\filemanager.py", line 435, in get model = self._dir_model(path, content=content) File "C:\Users\u1252652.conda\envs\DS011_loss_ratio\lib\site-packages\notebook\services\contents\filemanager.py", line 309, in _dir_model for name in os.listdir(os_dir): OSError: [WinError 87] The parameter is incorrect: 'C:\Users\u1252652\OneDrive - MMC\Documents\DS011_loss_ratio'
This is strange as i have been working in this directory and saving numerous notebooks to it without error until today. I can delete the notebook that caused it to crash and then it returns to normal and i can run notebooks that were already saved before today.
I am unsure if this is related or not but i also have an issue whereby i have to run python -m ipykernel install --user every time i change to a new environment in anaconda, otherwise the executable remains as that of the last environment i ran that command with. Perhaps this is useful i'm not sure, if anyone had advice with this too i'd be grateful.
I have also tried making a new directory, copying over the contents of the dysfunctional directory, and then making a new notebook from there, however this causes the same error.

Anaconda-Navigator problem loading packages

I am currently on Windows 11 and facing this problem since upgrade. Each time I install anaconda-navigator, on first time opening it runs smoothly however on second time if I open from windows, it opens but gets stuck on environment loading and when I open it from prompt, I get the error below. I do realize that error is from conda-script.py line587 however I don't want to do modifications blindly so need some expert opinion on how to resolve it.
I never faced these issues even on last moment on Windows 10, and I don't know how much windows upgrade is a problem here.
(base) C:\Users\abdul>anaconda-navigator
2021-10-20 19:51:06,740 - ERROR anaconda_api._pip_data_ready:579
C:/Users/abdul/anaconda3/python.exe C:/Users/abdul/anaconda3/Scripts/conda-script.py list --json: Not a conda environment: C:/ProgramData/Anaconda3
Traceback (most recent call last):
File "C:\Users\abdul\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 587, in _pip_data_ready
channel_urls = set(package['base_url'] for package in output if package['platform'] != 'pypi')
File "C:\Users\abdul\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 587, in <genexpr>
channel_urls = set(package['base_url'] for package in output if package['platform'] != 'pypi')
TypeError: string indices must be integers

Pyusb and Libusb giving NoBackendError on MacOS

I'm on MacOS Big Sur trying to run rfcat. I am running anaconda as well and I have set up an environment with Python2.7 when I originally got errors with Python3.x. I have downloaded the pyusb, pyreadline, ipython, PySide2, and the libusb dependancies. Libusb seems to be giving me the most trouble. I keep getting the following error:
Error in resetup():NoBackendError('No backend available',)
Error in resetup():NoBackendError('No backend available',)
Error in resetup():NoBackendError('No backend available',)
^CTraceback (most recent call last):
File "/opt/anaconda3/envs/rftools/bin/rfcat", line 4, in <module>
__import__('pkg_resources').run_script('rfcat==1.9.5', 'rfcat')
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat-1.9.5-py2.7.egg/EGG-INFO/scripts/rfcat", line 63, in <module>
File "build/bdist.macosx-10.7-x86_64/egg/rflib/__init__.py", line 208, in interactive
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_nic.py", line 103, in __init__
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_usb.py", line 93, in __init__
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_usb.py", line 238, in resetup
KeyboardInterrupt
From my research so far, backend is how pyusb refers to libusb, libusb1 or openusb. It is unable to find the libusb within the environment. I did a little tracking and found that ultimately, the find_library() function is found in ctypes in util.py. It refers to the executable path for MacOS with #executable_path/../lib/libusb%s..... I tried to put libusb into a folder on my executable path to hopefully match this functions search, and still got the same errors. I then found instructions on inputting a custom path for the backend for pyusb here. This appears to be a method where you input the device and backend information at the beginning of your program. The code I inserted is as follows:
import usb.core
import usb.backend.libusb1 as libusb1
backend = libusb1.get_backend(find_library=lambda x: "/path/to/file/lib/libusb-1.0.0.dylib")
dev = usb.core.find(idVendor=“MyVID”, idProduct=“MyPID”, backend=backend)
This induced a similar error but with a different traceback when I placed the code in rflib.init and the rfcat codes:
Traceback (most recent call last):
File "/opt/anaconda3/envs/rftools/bin/rfcat", line 4, in <module>
__import__('pkg_resources').run_script('rfcat==1.9.5', 'rfcat')
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat-1.9.5-py2.7.egg/EGG-INFO/scripts/rfcat", line 12, in <module>
File "build/bdist.macosx-10.7-x86_64/egg/rflib/__init__.py", line 15, in <module>
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb/core.py", line 1304, in find
raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
I have since reset things back to how I started and am still getting the original error listed above.
I think this largely has to do with the anaconda environment, which I can of course remove. I want to try to find a way to make this work though. Is there a better method to help rfcat find the libusb as required? Another possible solution is resolving the actual executable_path. Does anyone know how to find the executable_path?
In case it helps, I will list the default locations for commands and files.
rfcat: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat
pyusb: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb
ctypes: /opt/anaconda3/envs/rftools/lib/python2.7/ctypes
libusb: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb/lib

Couldn’t link model to ‘en_core_web_md’ on a Windows 10

I tried to try a chatbot made by a friend of mine with Rasa on a Windows 10. Getting started with the installation of the backend through their tutorial I was surprised that I couldn't link model to 'en_core_web_md' after using python -m spacy link en_core_web_md en. Here is the full error message:
Error: Couldn't link model to 'en_core_web_md'
Creating a symlink in spacy/data failed. Make sure you have the required
permissions and try re-running the command as admin, or use a
virtualenv. You can still import the model as a module and call its
load() method, or create the symlink manually.
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en_core_web_md
Creating a shortcut link for 'en' didn't work (maybe you don't have
admin permissions?), but you can still load the model via its full
package name: nlp = spacy.load('{name}')
Download successful but linking failed
(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>
(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>python -m spacy link en_core_web_md en
Error: Couldn't link model to 'en'
Creating a symlink in spacy/data failed. Make sure you have the required
permissions and try re-running the command as admin, or use a
virtualenv. You can still import the model as a module and call its
load() method, or create the symlink manually.
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en
Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\__main__.py", line 31, in <module>
plac.call(commands[command], sys.argv[1:])
File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\cli\link.py", line 48, in link
symlink_to(link_path, model_path)
File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\compat.py", line 87, in symlink_to
orig.symlink_to(dest)
File "C:\Python36\lib\pathlib.py", line 1327, in symlink_to
self._accessor.symlink(target, self, target_is_directory)
File "C:\Python36\lib\pathlib.py", line 393, in wrapped
return strfunc(str(pathobjA), str(pathobjB), *args)
OSError: symbolic link privilege not held
(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>sudo python -m spacy link en_core_web_md en
C:\Python36\python.exe: No module named spacy
It's weird because I was able to do so on Ubuntu.
Do you have any idea ?
This is a known problem. In fact your error message is giving exactly what went wrong. The script could not create Symbolic link (a Shortcut) for en_core_web_md. Perform the following to fix the issue
Goto your directory: C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\
Create a shortcut to destination: C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
Name it as en
If you want to know how to create the shortcut, following screenshots might help
Goto the folder, C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\ and right click and create shortcut
Provide the target directory: In you case it is
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
Then click on Next
You have to name the shortcut as en. Then click on Finish
Following the log that you have provided.
Is possible to be a permission problem.
Try to open CMD with Administrator privileges, and then run spacy link command again.
What I did was open bash as admin, then run the command:
python -m spacy link en_core_web_md en
If you are using a virtualenv make sure to activate the said virtualenv first.
You can also use the mklink command in cmd to create a symbolic link in the desired folder.
MKLINK [[/D] | [/H] | [/J]] Link Target
/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link Specifies the new symbolic link name.
Target Specifies the path (relative or absolute) that the new link
refers to.

Python web scraping stopped working - Invalid File Error

I have been working on a web scraping program and it has recently just stopped working and is giving me the following error.
Traceback (most recent call last):
File "C:/Users/Bob/Desktop/test 3.5.py", line 7, in <module>
with open(saveDB,'rb') as f:
TypeError: invalid file: WindowsPath('Z:/project1/MasterWellDB.txt')
Where Z: is a network drive, but I have also moved the file locally and the error still exists.
I have tried multiple python versions, uninstalled and reinstalled visual studio multiple times and I am still clueless.
Here is my code:
from pathlib import Path
import pickle
# Opening well database
saveDB = Path(r"Z:\project1\MasterWellDB.txt")
#open picked DB if avaiable else remake database
if saveDB.exists():
with open(saveDB,'rb') as f:
wells = pickle.load(f)
print('success!')
Any help would be greatly appreciated. Thanks!

Resources