ImportError: cannot import name 'WatermarkEncoder' from 'imWatermark' - python

I'm trying to run stable diffusion on my local pc. It's a macbook pro m1. Even though I did follow every single step, I keep getting an import error. What might possibly be the reason and how may I fix it?
ImportError: cannot import name 'WatermarkEncoder' from 'imWatermark'
I was referring an online tutorial so I did end up searching through the comments. Found nothing so far.

If you look in the txt2img.py script it references https://github.com/ShieldMnt/invisible-watermark
Install with pip install invisible-watermark

It seems they forgot to add it into requirements.txt or smt like that.
If you continue getting the error after invisible-watermark installation, change the line from imWatermark import WatermarkEncoder in txt2img.py to from imwatermark import WatermarkEncoder (lowercase)

Related

ImportError: cannot import name 'Random' from 'django.db.models.functions'

Well, I am trying to run my django project in new environment, I installed all of my requirements although every package is installed but it is still giving me below mentioned error. I am not sure but I am guessing it is due to version conflict of some modules.
I looked for existing solutions or someone who faced similar situation but no success.
the Random method is located in django/db/models/functions/math.py . change your import statement to this :
from django.db.models.functions.math import Random

ModuleNotFoundError: No module named 'h5pyViewer'

I have a question regarding h5pyViewer to view h5 files. I tried pip install h5pyViewer but that didn't work. I checked on Google and it states that h5pyViewer does not work for older versions of Python, but that there are a few solutions on GitHub. I downloaded this with pip install git+https://github.com/Eothred/h5pyViewer.git which finally gave me a successful installation.
Yet, when I want to import the package with import h5pyViewer it gave me the following error: ModuleNotFoundError: No module named 'h5pyViewer'. However when I tried to install it again it says:
Requirement already satisfied: h5pyviewer in c:\users\celin\anaconda3\lib\site-packages (-v0.0.1.15)Note: you may need to restart the kernel to use updated packages.
Any ideas how to get out of this loop or in what other way I could access an .h5 file?
There could be so many things wrong so it's hard to say what the problem is.
The actual package import has a lowercase "v": h5pyviewer (as seen in your error message).
Your IDE/python runner may not be using your Conda environment (you can select the environment in VSCode, and if you are running a script in the terminal make sure your Conda env is enabled in that terminal)
The GitHub package might be exported from somewhere else. Try something like from Eothred import h5pyviewer.
Maybe h5pyviewer is not even supposed to be imported this way!
Overall, I don't suggest using this package, it seems like it's broken on Python 3 and not well maintained. The code in GitHub looks sketchy, and very few people use it. A good indicator is usually the number of people that star or use the package, which seems extremely low. Additionally, it doesn't even have a real readme file! It doesn't say how to use it at all. Suggest you try something else like pandas. But if you really want to go with this, you can try the above debugging steps.

Python "ImportError: cannot import name 'pnoise1' from 'noise'"

I have been trying to use the noise module in Python for a game I was making. I am on the Mac OS, and I used pip3 install noise to download the module. I uninstalled and reinstalled it multiple times, without the wheel library, and with, as it recommended. The noise module itself downloads fine, but every time I try to import pnoise from it, I get an ImportError.
Just straight up importing noise (import noise) gives me no error, it just prints a string of numbers to my console. Also, downloading and running the module in a virtual environment works, so it must be something on my computer or OS.
Code: from noise import pnoise1
Error: ImportError: cannot import name 'pnoise1' from 'noise'
I have looked for a while for a solution, but nothing has seemed to help, it just doesn't work. The only information I have found is that this may be a file problem, but I haven't found out how to fix it.
Any help would be greatly appreciated.
Edit:
I ended up figuring it out. I was importing a file by the same name instead of the library. Thanks for the help, everyone!
To me it works ok. Have you installed it correctly via pip/pip3?
Ended up figuring it out, I was importing a file of mine instead of the library. Thanks for the help!

Unable to import pycolors (Pyling import error) Python error

I am currently trying to import some libraries/modules and everytime I try, it wont work and displays the pylint import error.
Here is what im trying to do:
import pycolors
I am using pylint, and I don't know how to fix this. I have watched several videos and done a ton of research, but none of them helped.
Pylint need to be in an environment where Pycolor is installed in order to not raise a warning . It's not clear whether the problem is when launching with python or analysing with pylint but in both case the solution is to install Pycolor: pip install Pycolor (If this is the one you want : https://pypi.org/project/Pycolor/)

Problem Importing Python Module adafruit_pca9685

I can't figure out how to troubleshoot an import that says it's working, but then obviously is failing. I'd appreciate any clues where to look.
I'm working on a raspberry Pi, but I'm seeing the same results on my windows machine. Both running Python 3.7 with Pip 20.
I start by installing the module with pip sudo pip3 install adafruit_pca9685
As you can see it says it's installed correctly.
Then I check that the module is installed with help('modules')
As you can see, it reports that the module isn't there right after it said it installed correctly.
Then I try to import the module with import adafruit_pca9685
Then it says that the module isn't found.
What should I be checking next to help solve this?
TLDR: Used find command to search for the file and found it was spelled differently than the tutorial indicated.
Oh man, do I feel dumb...
After suggesting I look for the file, I used find / -type f -iname "PCA9685.py.
I found the module installed, but it uses capitalization rather than all lower case which is what my documentation was requesting.
After correctly spelling the module name with capitalization, it imports fine.
It's annoying that this module is named in a different format than its sister modules, and annoying that the tutorial was wrong, but I feel dumb for not double checking the spelling.

Categories

Resources