Sunday, April 07, 2024

ModuleNotFoundError: No module named 'torch._custom_ops'

Did you ever feel like you were the only one on earth who has ever seen this error?  Well, just because your favorite search engines are not giving you results, does not mean you are alone.

Traceback (most recent call last):
  File "/usr/local/bin/easyocr", line 5, in <module>
    from easyocr.cli import main
  File "/usr/local/lib/python3.8/dist-packages/easyocr/__init__.py", line 1, in <module>
    from .easyocr import Reader
  File "/usr/local/lib/python3.8/dist-packages/easyocr/easyocr.py", line 3, in <module>
    from .recognition import get_recognizer, get_text
  File "/usr/local/lib/python3.8/dist-packages/easyocr/recognition.py", line 6, in <module>
    import torchvision.transforms as transforms
  File "/usr/local/lib/python3.8/dist-packages/torchvision/__init__.py", line 6, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
  File "/usr/local/lib/python3.8/dist-packages/torchvision/_meta_registrations.py", line 4, in <module>
    import torch._custom_ops
ModuleNotFoundError: No module named 'torch._custom_ops'

Got this after installing easyocr version 1.7.1 and executing the command "easyocr -l en -f image.png" in accord with these instructions.  To "solve" this problem after finding nothing with search engines, i simply commented out the lines in the file /usr/local/lib/python3.8/dist-packages/torchvision/_meta_registrations.py that referred to _custom_ops.

Then I started getting all the normal errors that you get with easyocr as follows:
$ easyocr -l en -f test_en.jpg 
/usr/local/lib/python3.8/dist-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: '/usr/local/lib/python3.8/dist-packages/torchvision/image.so: undefined symbol: _ZN3c104cuda9SetDeviceEi'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
  warn(
Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.
([[2, 2], [1002, 2], [1002, 34], [2, 34]], 'As Warren Buffett; one of the most successful investors of all time, said: "If you don\'t find', 0.6927859396455398)
([[2, 46], [724, 46], [724, 78], [2, 78]], 'way to make money while you sleep; you will work until you die"', 0.5957261107425325)

No idea about the "normal" errors, but at least you can start using easyocr like this:

$ easyocr -l en --detail 0 -f test_en.jpg  2>>/dev/null
As Warren Buffett; one of the most successful investors of all time, said: "If you don't find
way to make money while you sleep; you will work until you die"

Hope that helps.

P.S. If any of you know of an easy way to add Hebrew to my easyocr install, please let me know.
Currently getting this when trying to use easyocr to get Hebrew:

File "/usr/local/lib/python3.8/dist-packages/easyocr/easyocr.py", line 109, in __init__
    raise ValueError(unknown_lang, 'is not supported')
ValueError: ({'he'}, 'is not supported')

My favorite search engines are not suggesting anything to help me with this issue.  Imagine that.

Monday, May 24, 2021

How to Turn Off Google Assistant

Do you hate pop-ups like google assistant as much as I do?
I doubt it, but because I am willing to give you the benefit of the doubt, you get also get the following instructions for turning off the google assist garbage on your phone.

Steps to turn off:

0. Consider pruchasing one of these phones https://e.foundation/, and let me know if that works out for you.  I am seriously considering it also.  Google is getting too big for their britches.

1. Pull down twice from the top of your phone, you should see this gear icon for the "settings" and click the gear icon



2. Type "assistant" into the search settings bar at the top and click enter, then look for "Assistant Settings" in the list of results, and click it.


3. You will get a looong list of options, scroll down to find the "General" option and click it.

4.  You should see a screen like this where you can turn off the google assistant.  Make sure it is grey like it is in this picture.



You are welcome.  And again, please let me know if you E phone works out instead of this fix, I would really like to know.




Wednesday, October 12, 2016

Skype drops connection within about 20 seconds of initiating a call on MacOS

Is this happening to you? Well, I pain your feel! But do not worry, I figured it out. Simply kill Skype, remove your Skype application's user profile, and restart Skype. Then I was able to initiate a call over wifi, and it would not drop.  Specifically, this is what I did to fix the issue:
$ killall Skype
$ cd ~/Library/Application\ Support/
$ mv Skype ~/trash/Skype_01
$ mv Skype.app ~/trash/Skype.app_01
Then restarted Skype, and all was well with initiating calls. Here were the symptoms of what I was experiencing:
  1. If I initiated a call, it would drop within about 20 or 30 seconds of starting it. 
  2. If I was on a group call withe others, and I tried to share my screen ... it would silently fail and they would never see my screen share. 
  3. If someone else initiated the call, the call would procede normally, and it would not be dropped, so it makes you feel like you are the only one on the planet who ever sees this issue. 
  4. The problem crept in with a skype update within the last 6 months of 20161012, so some time after April of 2016. Installing Skype_7.37.178 did not help. 
  5. This was occurring on MacOS Yosemite and Sierra.
  6. Originally had Skype_6.17.60.477 installed and let Skype update itself from there.
I tried everything, nothing helped. Here were some of the things that failed to solve the issue:
  1. Basically, following most advice on this web site was useless.
  2. Specifically, these posts which came up first with google.
  3. There was this one post which I found after solving the issue which seemed to have an answer which was close to solving the issue on MacOS, but I basically had to google the solution in order to find this.
  4. Any posts which talked about adjusting Settings -> Energy Saver or using the "pmset" command to adjust power management settings or sleep settings ... these suggestions were useless.
  5. Upgrading to MacOS Sierra did not help.
Hope that helps.

Tuesday, December 08, 2015

org.osgi.framework.BundleException: Unresolved constraint in bundle jaxb-api

If you are getting this error message:
missing requirement [1.0] package; (package=javax.activation)
Do not worry, this is because you are unknowingly using the wrong version of Java to start glassfish. Even though you think you are running glassfish with the version in your shell's environment, either via sudo or some other sub process, the environment is not your own, and it is attempting to run glassfish with a different version of java (probably a newer version of java).

If you are running glassfish with sudo because of this bug, try these possible workarounds instead of the suggested ones:
JAVA_HOME=$JAVA_HOME ./asadmin start-domain --verbose=true domain1
sudo JAVA_HOME=$JAVA_HOME ./asadmin start-domain --verbose=true domain1

Hope that helps.

And here is more of the original error message in case yours is similar:
ERROR: Bundle jaxb-api [1]: Error starting file:/Users/apple/app_servers/oracle.com/glassfish-3.2-b07-05_12_2011.zip/glassfish3/glassfish/modules/endorsed/jaxb-api-osgi.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle jaxb-api [1]: Unable to resolve 1.0: missing requirement [1.0] package; (package=javax.activation))
org.osgi.framework.BundleException: Unresolved constraint in bundle jaxb-api [1]: Unable to resolve 1.0: missing requirement [1.0] package; (package=javax.activation)
 at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3443)
 at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
 at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1156)
 at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
 at java.lang.Thread.run(Thread.java:745)
ERROR: Bundle org.glassfish.metro.webservices-api-osgi [2]: Error starting file:/Users/apple/app_servers/oracle.com/glassfish-3.2-b07-05_12_2011.zip/glassfish3/glassfish/modules/endorsed/webservices-api-osgi.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle org.glassfish.metro.webservices-api-osgi [2]: Unable to resolve 2.0: missing requirement [2.0] package; (&(package=javax.xml.bind)(version>=2.2.2)) [caused by: Unable to resolve 1.0: missing requirement [1.0] package; (package=javax.activation)])
org.osgi.framework.BundleException: Unresolved constraint in bundle org.glassfish.metro.webservices-api-osgi [2]: Unable to resolve 2.0: missing requirement [2.0] package; (&(package=javax.xml.bind)(version>=2.2.2)) [caused by: Unable to resolve 1.0: missing requirement [1.0] package; (package=javax.activation)]

Tuesday, November 10, 2015

Cannot find function addEventListener in object [object HTMLDocument]

If you get this error, do not worry. The answer is not difficult to understand.
ANSWER: 
   do not initialize your HtmlUnit WebClient like this: 
      new WebClient();
   instead, initialize it like this: 
      new WebClient(BrowserVersion.FIREFOX_38);
The default "browser" that the HtmlUnit WebClient gives you does not have some of the basic JavaScript functions available to call such as "addEventListener".

See also: HtmlUnit issue tracker non-issue 1615.

Wednesday, September 23, 2015

None of the wicked shall understand, but those who are wise shall understand.  -- Daniel 12;10

Wednesday, September 02, 2015

Friday, July 03, 2015

Author: (no author) not defined in ../authors.txt file

If you are using svn2git and get this error:
Author: (no author) not defined in ../authors.txt file
Do not worry. Simply add this line to your authors.txt file:
(no author) = no_author <no_author@yourdomain.com>
Hope that helps.

Wednesday, January 28, 2015

When compiling mojarra ... javac: invalid target release: 1.8

If you go to compile mojarra, the JSF reference implementation, and get this error: javac: invalid target release: 1.8 Do not worry.

It just means that you are trying to compile mojarra with an older version of java. Mojarra requires java 1.8 at least as of this blog post. Just change your JAVA_HOME to point to a java 1.8+ version and try again.

Hope that helps.

Saturday, September 06, 2014

Exception: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

If you get this error, do not worry:
Downloading: https://s3.amazonaws.com/Minecraft.Download/launcher/launcher.pack.lzma Exception: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
This just means that your ssl certs are not correct for the java version you have installed. In my case I was also getting the following error:
$ ls -l /etc/ssl/certs/java/cacerts ls: cannot access /etc/ssl/certs/java/cacerts: No such file or directory
So, this command fixed my issue:
scp -pr root@a_different_box_with_working_certs:/etc/ssl/certs/java/cacerts /etc/ssl/certs/java/.
Hope that helps you too.

This was found using the following version of java:
$ java -version
openjdk version "1.8.0_20" OpenJDK Runtime Environment (build 1.8.0_20-b23) OpenJDK 64-Bit Server VM (build 25.20-b22, mixed mode)

Friday, January 31, 2014

Element is not currently visible and so may not be interacted with

This page was somewhat helpful, but did not mention the "transform" style needing to be checked. Then I found this fellow using C# who mentioned the transform value. When I put the two together I came up with this solution:
((JavascriptExecutor)driver).executeScript(
   "arguments[0].style.transform = 'none';",
   myFavoriteElement
);
After setting transform = 'none', myFavoriteElement.sendKeys() did not fail with the infamous error:
Element is not currently visible and so may not be interacted with(..)
So I guess we should add transform != 'none' to the list as follows:
  • visibility != hidden
  • display != none (is also checked against every parent element)
  • opacity != 0 (in rc2 this is no longer checked for clicking an element)
  • height and width are both > 0
  • for an input, the attribute type != hidden
  • transform != 'none'
This issue was found using selenium.version = 2.35.0

NOTE: myFavoriteElement was an input type=file generated by the PrimeFaces fileUpload tag. PrimeFaces 4.0 looks like it introduced the transform. Also, when I checked to see what the transform value was before setting it to none, it logged: myFavoriteElement.getCssValue("transform") = matrix(4, 0, 0, 4, -300, 0).

Hope that helps.

Saturday, August 17, 2013

Sunday, March 10, 2013

Loan's Beautiful Thoughts


Click to enlarge

* Feeding children, and taking them out for fun is easy. But teaching children to know and to follow in righteousness is hard.
* Cho con ăn ngon thì dể, cho con đi chơi thật thú vị cũng dể. Nhưng dạy con biết và làm theo dúng phải thì khó.

And from Billy Graham:
* Pleasures are the things that appeal to our flesh and to our lust. But joy is something else. Joy runs deep.
* Vui thích là điều xuất phát trong xác thịt và tình dục. Nhưng vui mừng thì khác hẵn. Vui mừng thật sâu đậm.

You can find more inspiration from Loan's musings and some of her favorite quotes here in English, and here in Vietnamese.

In Him.

Friday, March 08, 2013

Gnome3 Terminal does not execute my .bash_profile

If you have ever had this issue where changes to your .bash_profile do not take effect the next time you launch the gnome-terminal.  Well, do not worry.  Just open the gnome-terminal and go to Edit -> Profile Preferences _> Title and Command (tab), and you will see this:

Click to enlarge

Make sure that the "Run commnad as a login shell" is checked.  Then close, and close the terminal, and relaunch gnome-terminal, and you should see that your .bash_profile has been executed.

Hope that helps.

Tuesday, March 05, 2013

SOLUTION: fatal: Couldn't find remote ref {Branch} Unexpected end of command stream

Symptoms:  You issue a command and get the error like this:

$ git pull --rebase upstream a_branch_that_we_KNOW_is_there
fatal: Couldn't find remote ref a_branch_that_we_KNOW_is_there
Unexpected end of command stream

Assumptions:
1) the name of your remote repository is "upstream"
2) the branch you are pulling from is called "a_branch_that_we_KNOW_is_there"

There may be many ways to get this kind of error, but I suspect that I am not the only one who will get caught by this time wasting variant.

Reason: The reason you are getting the error is because the branch DOES exist at the correct repository, but you have requested a pull or fetch from the wrong repository.  And that branch name does NOT exist in the repo that you have requested a pull or fetch from.

How is that possible?

Cause: You may have accidentally added a remote name that points to the wrong git repository.

You can check the repository that your remote points to this way:
$ git remote show upstream
* remote upstream
  Fetch URL: https://github.com/pkg/pkg-module.git
  Push  URL: https://github.com/pkg/pkg-module.git
  HEAD branch: master
  Remote branches:
    some_other_branch_that_we_do_not_expect  tracked
    master                                   tracked
  Local ref configured for 'git push':
    master pushes to master (local out of date)

Or maybe this way:
$ git config --list | grep upstream
remote.upstream.url=https://github.com/pkg/pkg-module.git
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*

Either way, check very carefully that the Fetch URL is correct.  If you are silly like we are and have several modules in the same package, you may not have noticed the rogue:

git remote add upstream https://github.com/pkg/pkg-module.git

instead of the correct git repository:

git remote add upstream https://github.com/pkg/pkg-modulo.git

Easy to miss something like this, if you ask me.

Solution: remove the name of the remote that points to the wrong repo, and re-add the name back so that it points to the correct git repository.  Assuming your remote alias name is "upstream", you can fix that like this:

$ git remote rm upstream
$ git remote add upstream https://github.com/pkg/pkg-modulo.git

Now Your pull command should work successfully. But just in case, here is yet another way to check to make sure:

$ git ls-remote | grep a_branch_that_we_KNOW_is_there
From https://github.com/pkg/pkg-modulo.git
934a29d142efda2f40efced8a2126c5499162e03 refs/heads/a_branch_that_we_KNOW_is_there

Hope that helps.

Friday, February 22, 2013

sort find results by date and time


Have you ever wanted to find all the files below your current directory and sort them by thier last modification time? Try this:
find . -printf "%T+\t%p\n" | sort
Here is the breakdown:

%T is file's last modification time in the format specified by k, which is the same as for %A. By the way, %A could be used to sort by access times instead of modification times.

+ means render the date and time, separated by "+", for example "2013-02-22+08:19:06.3877437110".

\t is a tab character

%p is the file name

All of this information and more might be gleaned by typing "man find" and searching for the section describing "printf" and its options.

Hope that helps.

Please help us learn how to do this on a mac (or windows) on the command line without a 20 minute mac ports install.

Saturday, February 02, 2013

Fun family pictures


Hello sushi!


Hello flowers ... peek - a - boo!


Looks delicious.


Froggy


Uh ... mazing Korean food in Diamond Bar, CA.
Young Dong Tofu.   Try their Bipp n' bopp!


Bipp n' Bopp in the lower left stone bowl ... yummmm.


Good-bye :-)

  

Hmm.



Wednesday, January 30, 2013

Dashes or other special characters "confuse" Spotlight on mac osx ...

Have you been trying to figure out why spotlight cannot find a file with a dash in the name?  How much time have you wasted wondering about this?  Well, look no further.  If your problem is something like this:
You know that there is a file on your mac called "something-book.pdf", so like an idiot, thinking that Spotlight will be friendly, you type what you know, -book.pdf, into Spotlight, and the "Top Hit" is "App Store" ... sigh.  You _know_ that the file is there somewhere!  But where is it?  Well, simply try this:

Solution:  Put the fragment of the filename in quotes, and viola, there is your file.  


Why should you have to put it in quotes you ask?  Why wouldn't it automatically default to putting everything in quotes itself, you ask?  Why isn't it more user friendly?  Well the answer is apparently embedded in the logic sourced in this document.

http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html

Let me know, when you have memorized that document, and can explain this is layman's terms.  Until then, let's see if you and I are the only two people who have ever experienced any issue with Spotlight.  The comments (or lack thereof) should be very telling.

Hope that helps.

Tuesday, January 22, 2013

Sunday, January 06, 2013

New post ... old picture

It's always fun to find great older pictures.