ImportError: cannot import name 'just_fix_windows_console' from 'colorama' - colorama

I'm trying to execute bayesian optimizer but I always get the same error.
I tried "pip install -U colorama" but it still doesn't work
ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_13036\1140567575.py in <module>
----> 1 from colorama import just_fix_windows_console
2 just_fix_windows_console()
ImportError: cannot import name 'just_fix_windows_console' from 'colorama'

I had the same issue. For me, the following worked:
pip install colorama=0.4.4
pip install bayesian-optimization=1.4.0

Related

'No module named 'pyfirmata'' error even though I have already installed pyfirmata using pip?

I started by uploading the StandardFirmata example from the Arduino IDE onto my Arduino UNO. I then successfully installed pyfirmata onto my windows pc using pip3 install pyfirmata to the path c:\users\ta319\anaconda3\lib\site-packages, however, when I try to run the following code in spyder:
#!/usr/bin/env python3
import pyfirmata
import time
if __name__ == '__main__':
board = pyfirmata.Arduino('COM4 (Arduino UNO)')
print("Communication Successfully started")
while True:
board.digital[13].write(1)
time.sleep(1)
board.digital[13].write(0)
time.sleep(1)
I get this error:
Traceback (most recent call last):
File
"C:\Users\ta319\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\py3compat.py",
line 356, in compat_exec
exec(code, globals, locals)
File "c:\users\ta319\firmata setup.py", line 3, in
import pyfirmata
ModuleNotFoundError: No module named 'pyfirmata'
Any suggestions would be greatly appreciated, thanks!
You probably installed with pip and not pip3, try
python3 -m pip install pyfirmata or pip3 install pyfirmata

ModuleNotFoundError: No module named 'cleverhans.utils_keras' in Colab

I used the following to install cleverhans in Colab:
!pip install -qq -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans
import sys
sys.path.append('/content/src/cleverhans')
import cleverhans
And it seems to work good. Then I use the following:
from cleverhans.utils_keras import KerasModelWrapper
wrap = KerasModelWrapper(network)
And I get:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-42-bf6d85d04ab3> in <module>()
----> 1 from cleverhans.utils_keras import KerasModelWrapper
2 wrap = KerasModelWrapper(network)
ModuleNotFoundError: No module named 'cleverhans.utils_keras'
Module cleverhans.utils_keras is a part of cleverhans_v3.1.0. The subdirectory has its own setup.py, i.e. it's its own separate package. Install it with the command
!pip install -U "git+https://github.com/cleverhans-lab/cleverhans.git#egg=cleverhans&subdirectory=cleverhans_v3.1.0"

Problem installing importlib on Mac with pip3

Good morning!
Until yesterday I was using python 2.7 and using the following code for writing output files for my scripts:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
But now I'm upgrading my code to python 3.7, so now I need to use importlib.reloadinstead of just reload. However, typing sudo -H pip3 install importlib on my shell gives me the following error:
Collecting importlib
Using cached https://files.pythonhosted.org/packages/31/77/3781f65cafe55480b56914def99022a5d2965a4bb269655c89ef2f1de3cd/importlib-1.0.4.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 6, in <module>
import distutils.core
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 16, in <module>
from distutils.dist import Distribution
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 19, in <module>
from distutils.util import check_environ, strtobool, rfc822_escape
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/util.py", line 9, in <module>
import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-3cz_3d6n/importlib/
After looking for solutions I also tried to upgrade setuptools, but that didn't fix my problem.
Many thanks in advance!
importlib at PyPI is an outdated package intended for very old Python versions. For new versions of Python importlib is a module from the standard library, you don't need to install it, it's always available.

after installing seaborn, import fails to find it

I've tried installing seaborn under anaconda on my mac. I've tried following many different instructions.
It installs with no problem but "import seaborn" fails.
I'm using Python 2.7 here. It will work for me under Python 3 but unfortunately I'm taking a course in which the notebooks are Python 2.7.
import seaborn
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-085c0287ecb5> in <module>()
----> 1 import seaborn
ImportError: No module named seaborn

Version upgrade to scikit-learn

I wanted to do LDA on some data and so followed this example:
http://scikit-learn.org/stable/auto_examples/decomposition/plot_pca_vs_lda.html#example-decomposition-plot-pca-vs-lda-py
however, on trying:
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
I got an import error. Huh, maybe this is a new function, I thought. So I updated scikit-learn via conda from 0.15.2 to 0.17. But now I can't even import sklearn:
import sklearn
RuntimeError: module compiled against API version a but this version of numpy is 9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "//anaconda/lib/python2.7/site-packages/sklearn/base.py", line 9, in <module>
from scipy import sparse
File "//anaconda/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 213, in <module>
from .csr import *
File "//anaconda/lib/python2.7/site-packages/scipy/sparse/csr.py", line 13, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: numpy.core.multiarray failed to import
I tried updating numpy and scipy using both pip and conda to no avail. I then tried a complete clean re-install of anaconda by:
rm -rf ~/anaconda
and a subsequent download of the .pkg from http://docs.continuum.io/anaconda/install#anaconda-install
Still I get the same error. Here are my OS and package details:
Mac OSX 10.5.2
bash-3.2$ conda -V
conda 3.18.6
scipy==0.16.0
numpy==1.9.1
scikit-learn==0.17
The last of these via pip freeze since I can't import it. I'm going nuts here. Any help much appreciated.
Try:
conda install numpy=1.10.1
I've had that module compiled against API version a but this version of numpy is 9 error before, and this solved it for me.

Resources