Module not found error for pyttsx3 failing to import after successful installation - module

The question basically covers it all. All the installations (pyttsx3, new version of pip) are successful. No issues there. It was showing some permission error for a moment, so I tried turning off the antivirus and the error went away, pyttsx3 still won't work. It is failing to import all the while showing requirements already satisfied.
It is actually running on a different computer following the same steps but not this one. What else can I check?
Thank you.
ModuleNotFoundError Traceback (most recent call last)
Input In [10], in <module>
----> 1 import pyttsx3
2 pyobj=pyttsx3.init()
3 pyobj.say("welcome to python")
ModuleNotFoundError: No module named 'pyttsx3'

Related

file_utils module import failing in colab

I am trying to run BertForSequenceClassification from within Google Colab. My notebook needs to import BertForSequenceClassification from modeling_readmission, but modeling_readmission.py itself contains an important statement that is failing.
from file_utils import cached_path
Other imports like torch work. I tried running
!pip install file_utils
in the previous cell, and it claims to be successfully installed, but the import fails. Another post suggests restarting the module. Did that, no help.
Ironically, you can pip install and do the import from the same cell, and you will get a "successful" installed (or " requirement satisfied") message followed by the error.
Requirement already satisfied: file_utils in /usr/local/lib/python3.7/dist-packages (0.0.1)
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-cd0910142da0> in <module>()
1 get_ipython().system('pip install file_utils')
----> 2 import file_utils
I did note that the successful import statement claims that file_utils is installed at
/usr/local/lib/python3.7/dist-packages (0.0.1),
and if you do an !ls on that folder you will indeed see a directory entitled 'file.utils-0.0.1.dist-info, inside of which are INSTALLER, LICENSE, METADATA, RECORD, REQUESTED top_level_txt, WHEEL. I should add that, as recommended in other stackoverflow posts, I also tried appending system paths using:
sys.path.append('./')
sys.path.append('/content/drive/My Drive/CAMLBERT/') #location of modeling_readmission.py
sys.path.append('/usr/local/lib/python3.7/dist-packages') # alleged location of file_utils
Despite looking through several similar stackoverflow posts on colab install failures, I'm totally at a loss. How do I get my Colab to recognize that file_utils has been installed? And how do I get this notebook, which needs to import from modeling_readmission, to run without needing a restart after file_utils is installed?
I'm not sure this is a great answer, but it is a workaround. I simply copied the contents of file_utils.py into a folder and placed them in the main directory of my project. Things ran fine after that.

using snakemake.utils in profile without using conda-not-block-search-path-envvars

I just updated from snakemake 5.28 to 5.32, and now from snakemake.utils import read_job_properties throws an import error for my job submission script in my snakemake profile:
Traceback (most recent call last):
File "/ebio/abt3_projects/software/dev/ll_pipelines/llmgqc/bin/ll_pipeline_utils/profiles/sge/sge-submit.py", line 7, in <module>
from snakemake.utils import read_job_properties
ModuleNotFoundError: No module named 'snakemake'
Using --conda-not-block-search-path-envvars prevents this import error, but I'd rather not have to use --conda-not-block-search-path-envvars every time I run snakemake.
I don't see anything special that the SLURM snakemake profile uses to get around this import issue, so I really don't know what to do besides using --conda-not-block-search-path-envvars all of the time.

Error when using pyautogui module in Mu-Editor

I'm trying to write some code and import the pyautogui module, but am getting an error.
import pyautogui
import webbrowser
webbrowser.open('https://roamresearch.com/#/app/test852')
b = pyautogui.locateOnScreen('JournalQuestions.png')
I'm getting the following error:
Traceback (most recent call last):
File "/Users/rika/mu_code/mouse.py", line 2, in
import pyautogui
ModuleNotFoundError: No module named 'pyautogui'
I found the answer in the Mu-Editor community. I just needed to download the Alpha version from here: https://codewith.mu/en/download. Then click on Gears icon and there is a tab for importing packages. Very user friendly!

Anaconda install of Tensorflow missing 'audio_ops' from contrib framework

I'm trying to follow along the Audio Recognition Network tutorial.
I've created an Anaconda environment with python 3.6 and followed the install instruction accordingly for installing the GPU whl.
I can run the 'hello world' TF example.
When I go to run 'train.py' in the Audio Recognition Network tutorial/example, I get:
Traceback (most recent call last):
File "train.py", line 79, in <module>
import input_data
File "/home/philglau/speech_commands/input_data.py", line 35, in <module>
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
ImportError: cannot import name 'audio_ops'
The code in the tutorial that fails is:
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
I then backed up that chain until I could import some part of it:
import tensorflow.contrib.framework as test ==> works
import tensorflow.contrib.framework.python as test --> fail:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.framework' has no attribute 'python'
Not sure where I'm going wrong on my install.
Details:
Ubuntu 16.04
Anaconda env with python 3.6
Followed the 'anaconda' instruction on the TF install page. (GPU version)
I also tried using a python 2.7 env for anaconda but got the same results.
It looks like they're releasing the audio_ops modules in version 1.4 (https://github.com/tensorflow/tensorflow/issues/11339#issuecomment-327879009).
Until v1.4 is released, an easy way around this is to install the nightly tensorflow build
pip install tf-nightly
or with the docker image linked in the issue comment.
The short answer:
The framework is missing the "audio_ops.py" and the example wont work until the file is released. Or you code the wrappers.
More on this:
If you go to the: tensorflow.contrib.framework.python.ops local folder you can find other *_ops.py files but not the "audio_ops.py".
If you get it from the Master at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/framework/python/ops
You will find the file is almost empty and with import labels wrong: "audio_ops" vs "gen_audio_ops".
With almost empty I mean that: decode_wav, encode_wav, audio_spectrogram , mfcc are not implemented/wrapped.
So, no working example and no fun.
We need to check again when "audio_ops.py" is released.
Here:
https://github.com/tensorflow/tensorflow/issues/11339
You can find a Developer saying: "we don't actually want to make them public / supported yet. I'm sorry this decision wasn't better documented"

Running HtmlUnit with Jython

This question is similar to this one and this one
I am running windows 7(x64) and following the example on this page:
http://blog.databigbang.com/web-scraping-ajax-and-javascript-sites/
I get a similar error:
Traceback (most recent call last):
File ".\gartner.py", line 24, in
import com.gargoylesoftware.htmlunit.WebClient as WebClient
ImportError: No module named gargoylesoftware
Running the script as (with the latest htmlunit-2.9):
>> jython -J-classpath "htmlunit-2.9/lib/*" gartner.py
I have also attempted second answer to this to no avail.
Any suggestions?
Thanks
Edit1:
I added "htmlunit-2.9/lib/" to my classpath through the system environment variables.
>> jython gartner.py
Same error as above.