python -m pip install urllib having systax error while installation of this module - module

here see what happened
when I run the above command cmd I get an error while installing. As you can see in the above image.
s.connect((base64.b64decode(rip),17620)
I get syntax error: invalid token in line 191
and it is also giving me problems on some other modules also.
s.connect((base64.b64decode(rip),17620)
I get syntax error: invalid token in line 191

(I ran into this myself using jupyter notebook)
As you are using python 3 you don't need to install URL lib as it is part of core https://github.com/python/cpython/tree/3.6/Lib/urllib/
It's submodules are restructured so you need to change python 2 code like
import urllib
...
urllib.urlopen
into
import urllib.request
...
urllib.request.urlopen

Related

Unable to load fasttext-wiki-news-subswords-300

Starting with the gensim api:
import gensim.downloader as api
api.load('fasttext-wiki-news-subwords-300')
I get the error:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user.name/gensim-data/fasttext-wiki-news-subwords-300/fasttext-wiki-news-subwords-300.gz'
I also tried the cli:
python3 -m gensim.downloader --download fasttext-wiki-news-subwords-300
and when I check the ~/gensim-data/fasttext-wiki-news-subwords-300 folder it only contains:
__init__.py
__pycache__
Have there been any changes to the to api or the dataset in the last few months?
Note
I am using Python3.8 and gensim==4.2.0
I have checked that the Certificates are Installed ('Install Certificates.command').
I ended up deleting the ~/gensim-data folder and downgraded gensim to 3.8.3, seems to be working now. Leaving the question and answer here as (1) error message was a red herring and (2) solution was not straightforward.

Rapids on colab

I have always used following commands to install Rapids on Colab (from https://colab.research.google.com/drive/1rY7Ln6rEE1pOlfSHCYOVaqt8OvDO35J0#forceEdit=true&offline=true&sandboxMode=true)
!git clone https://github.com/rapidsai/rapidsai-csp-utils.git
!python rapidsai-csp-utils/colab/env-check.py
!bash rapidsai-csp-utils/colab/update_gcc.sh
import os
os._exit(00)
import condacolab
condacolab.install()
import condacolab
condacolab.check()
# Installing RAPIDS is now 'python rapidsai-csp-utils/colab/install_rapids.py <release> <packages>'
# The <release> options are 'stable' and 'nightly'. Leaving it blank or adding any other words will default to stable.
!python rapidsai-csp-utils/colab/install_rapids.py stable
import os
os.environ['NUMBAPRO_NVVM'] = '/usr/local/cuda/nvvm/lib64/libnvvm.so'
os.environ['NUMBAPRO_LIBDEVICE'] = '/usr/local/cuda/nvvm/libdevice/'
os.environ['CONDA_PREFIX'] = '/usr/local'
it always worked, but lately I get
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
CondaHTTPError: HTTP 403 FORBIDDEN for url <https://conda.anaconda.org/rapidsai/linux-64/ucx-1.11.2 gef2bbcf-cuda11.2_0.tar.bz2>
Elapsed: 00:00.358595
I have retried several times but it doesnt work, how can I solve it?

Orange Error During Installing Text Add On

I am trying to install the Text add-on (version 0.7.3) for Orange (version 3.23) on my Win10, but I am getting the following error during the building "ufal_udpipe":
Command failed: python python -m pip install --constraint 'C:\Users\Jakub\AppData\Local\Temp\tmpb4fneogu.txt' Orange3-Text exited with non zero status.
ERROR: Command errored out with exit status 1: 'C:\Users\Jakub\AppData\Local\Orange\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Jakub\\AppData\\Local\\Temp\\pip-install-r71cit89\\ufal.udpipe\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jakub\\AppData\\Local\\Temp\\pip-install-r71cit89\\ufal.udpipe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Jakub\AppData\Local\Temp\pip-record-gtt8e801\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
I also tried to install Microsoft Visual C++, because it´s required in the log, but the problem is the same after the installation.
I tried to install add-on throught the Anaconda Prompt:
conda config --add channels conda-forge
conda install orange3-text
This process failed, because:
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while installing package 'conda-forge::commonmark-0.9.0-py_0'.
CondaError: Cannot link a source that does not exist. C:\Users\Jakub\Miniconda3\Scripts\conda.exe
Running `conda clean --packages` may resolve your problem.
Attempting to roll back.
Rolling back transaction: done
The result of conda clean command is following:
Traceback (most recent call last):
File "C:\Users\Jakub\Miniconda3\Scripts\conda-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\cli\main.py", line 112, in main
from ..exceptions import conda_exception_handler
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\exceptions.py", line 18, in <module>
from .common.io import timeout
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\common\io.py", line 28, in <module>
from .._vendor.tqdm import tqdm
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\__init__.py", line 8, in <module>
from ._tqdm import tqdm
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\_tqdm.py", line 13, in <module>
from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\_utils.py", line 31, in <module>
colorama.init()
AttributeError: module 'colorama' has no attribute 'init'
Reinstall of Orange and Anaconda didn´t help.
Full extract of logs is here: Google Disk
Thank you for your help!
Jakub
I encountered just the first line of your error. I checked if I had python and anaconda installed properly or not (and I had). I then kept trying to install and in the 4th go it installed without an issue- now my guess is maybe network issues caused the error to occur.
Another thing suggested to me by their support was- "Yes, we are aware of the issue. Somewhere in the process we accidentally disabled the necessary setting. Go to Options - Settings, find the Add-ons tab and select 'Install add-ons with conda'. This should install Text successfully."
Okay, so I found the issue fix (at least for me - comment if it works for you).
How to fix it:
Download Colorama
Copy the "Colorama" from the download then replace the folder named "colorama" in C:\Program Files\Anaconda3\Lib\site-packages
I suspect this issue occurs because of (issue 8842)

Launching Tensorboard: bad interpreter: No such file or directory

I am unable to run tensorboard, and get the message:
bad interpreter: No such file or directory
Steps to reproduce:
Installed TF on Ubuntu, using a virtenv, and pip as per instructions install instructions
Confirmed TF was correctly installed by running the mnist example. Output was as expected
Attempted to run tensorboard using:
tensorboard --logdir=/tmp/tensorflow/mnist/logs/mnist_with_summaries/
Checked that this location does contain the summary files within the "test" and "train" directories
Command and error:
(tensorflow_1_4_0) js#pchome01:~$ tensorboard --logdir=/tmp/tensorflow/mnist/logs/mnist_with_summaries/
bash: /home/js/tensorflow_1_4_0/bin/tensorboard: /home/js/tensorflow_1_3/bin/python3: bad interpreter: No such file or directory
In my virtenv folder for tensorflow_1_4_0, a tensorboard script exists:
#!/home/js/tensorflow_1_3/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from tensorboard.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
When I run the following from the terminal, no errors are reported:
from tensorboard.main import main
Thank you
Just spotted my silly mistake and posting the resolution in case others encounter this.
The meaning of the error message is that the interpreter of the code (in this case python3) cannot be found.
The first line of the tensorboard script:
#!/home/js/tensorflow_1_3/bin/python3
This tells the compiler to look for python3 at this location, however this path is incorrect and the virtual environment is actually called tensorflow_1_4_0.
Therefore changing this line to the following fixed the error:
#!/home/js/tensorflow_1_4_0/bin/python3

Numpy and matplotlib without compiling/building in virtualenv

I'm trying to set up virtualenv with numpy. I've found that the recommended way to do it is by using
python setup.py install
in the numpy directory while under virtual enviroment.
I was wondering if it's possible to avoid the fortran compiling and just use a numpy binary available for OS?
Has anyone tried this? I couldn't figure out where is numpy located.
UPDATE:
Managed to do something.
Searched for "numpy" in my file system and found it in "usr/lib/pymodules/python2.7/numpy".
Then i just copied that to my virtualenv folder to "lib/pymodules/python2.7"
For now, i was able to call all numpy methods i tried.
UPDATE:
Tried to install matplotlib since numpy is a dependency for it. That failed:
REQUIRED DEPENDENCIES
numpy: 1.5.1
freetype2: found, but unknown version (no pkg-config)
* WARNING: Could not find 'freetype2' headers in any
* of '/usr/include', '.', '/usr/include/freetype2',
* './freetype2'.
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
warning: no files found matching 'KNOWN_BUGS'
warning: no files found matching 'INTERACTIVE'
warning: no files found matching 'MANIFEST'
warning: no files found matching '__init__.py'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
warning: no files found matching 'LICENSE*' under directory 'license'
In file included from ./CXX/Extensions.hxx:37:0,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
It does seem so that it isn't numpy which is causing the errors. Trying to diagnose the cause of the error...
UPDATE:
Manually went through all REQUIRED DEPENDENCIES and installed them.
It flied by to fast so i didn't notice it, and believed it yielded no errors.
Probably you need python dev package. try this
sudo apt-get install python2.7-dev
Not sure what OS you're using, but I would just use an EPD Free binary for this. Granted, you get SciPy and some other stuff along with it, but it's about as hassle-free as you can get.