error when downloading the gensim package in python - python

I have been trying to install the gensim package in python using pip, using the pip.main(['install','gensim']). It works and starts downloading, but then I get the following error:
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
gensim from https://files.pythonhosted.org/packages/82/f2/c2f2c87ed72483fce010fbfea1a3adbd168c0f0dafc878cbfb5a76381b03/gensim-3.4.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#sha256=7bafe3f2fd49738942ef04396cb1e50a38283fe02203e5d4c66588daa01fb87c:
Expected sha256 7bafe3f2fd49738942ef04396cb1e50a38283fe02203e5d4c66588daa01fb87c
Got 728e9e79db209cfb0699c815c30a6169cefa61f46ef3471937100e4173fdbb3d
Any help would be appreciated

It seems like the package pip is trying to download and install is being modified in transit. You should be able to download, verify, and install the package yourself.
Download the package:
$ curl -O https://files.pythonhosted.org/packages/82/f2/c2f2c87ed72483fce010fbfea1a3adbd168c0f0dafc878cbfb5a76381b03/gensim-3.4.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Calculate the SHA256 sum to ensure the package has not been modifed:
$ openssl sha256 gensim-3.4.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
The output should be 7bafe3f2fd49738942ef04396cb1e50a38283fe02203e5d4c66588daa01fb87c (according to https://pypi.org/project/gensim/#files)
Install the package:
$ pip install gensim-3.4.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

I didn't solve the problem but I found a way to work around this challenge. I started using anaconda directly. I used the navigator to install gensim in my environments, then I used the spyder command prompt to run my codes.
These links are useful:
https://docs.anaconda.com/anaconda/navigator/
https://docs.anaconda.com/anaconda/install/
https://www.anaconda.com/download/#macos

Related

No module found error for a downloaded package (sksparse.cholmod) and how to download a package from the internet to conda

I need to use the sksparse.chomod package however my pycharm does not let me install it as it can't seem to find it.
I found the sksparse package on github and downloaded it but I do not know how to add a package downloaded from the internet into a conda environment. So, my first question would be can you download a package from github and add it to your conda environment, and how do you do this?
As I did not know how to do the above I instead saved the package within my project and thought I could simply import sksparse.cholmod. However, the line in my code that says import sksparse.cholmod as sks has no errors with it, so I assumed that meant this was ok, but when I try to run my file I get this error:
import sksparse.cholmod as sks
ModuleNotFoundError: No module named 'sksparse.cholmod'
If I have downloaded the package into my project why can't it be found, yet there are no errors when importing?
The cholmod file is a pyx file which I've been told should not be a problem.
Please could anyone help, I am reasonably new to python and I am looking for a straight forward solution that won't be time consuming.
It was an issue with windows, I was able to fix this using the instructions on this link
https://github.com/EmJay276/scikit-sparse
We must follow these steps precisely:
(This was tested with a Anaconda 3 installation and Python 3.7)
Install these requirements in order:
'''
conda install -c conda-forge numpy - tested with v1.19.1
conda install -c anaconda scipy - tested with v1.5.0
conda install -c conda-forge cython - tested with v0.29.21
conda install -c conda-forge suitesparse - tested with v5.4.0
'''
Download Microsoft Build Tools for C++ from https://visualstudio.microsoft.com/de/visual-cpp-build-tools/ (tested with 2019, should work with 2015 or newer)
Install Visual Studio Build Tools
Choose Workloads
Check "C++ Buildtools"
Keep standard settings
Run ''' pip install git+https://github.com/EmJay276/scikit-sparse '''
Test ''' from sksparse.cholmod import cholesky '''
Use all the versions stated for numpy etc, however with scipy I installed the latest version and it worked fine.

Tensorflow installation occurs when using pip

I'm trying to install TensorFlow using pip.Python version is 3.7.6 and pip version pip-20.0.2.when I run following line in command prompt
python -m pip install --user tensorflow
after downloading 20% I get the following message and download stopped.
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the
hashes. Otherwise, examine the package contents carefully; someone may
have tampered with them.
tensorflow from https://files.pythonhosted.org/packages/34/d5/ce8c17971067c0184c9045112b755be5461d5ce5253ef65a367e1298d7c5/tensorflow-2.1.0-cp37-cp37m-win_amd64.whl#sha256=7bad8ea686a1f33d9dac13eb578c4597346789d4f826980c8bbcfbd08e7dc921:
Expected sha256 7bad8ea686a1f33d9dac13eb578c4597346789d4f826980c8bbcfbd08e7dc921
Got dc1712222e4d481bf78da6cd0d9337752ed75654981cee3dd0f28523928c5beb
Please provide me some solutions.i am having lots of difficulties.

How to update packages hashes?

I'm sort of new to python, and using Anaconda3-5.1.0 on windows 10
i need to install package kwant, kwant is n't coming for anaconda windows , so i try pip install it ,after some struggle and reading here I found
kwant-1.3.2-cp36-cp36m-win_amd64.whl
so it match the platform , but this package need scipy and numpy and this comes with anaconda and when i try to pip install kwant ,i get this
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
scipy>=0.14 from https://files.pythonhosted.org/packages/62/e2/364f0bcc641aeff79d743c732769d5dc31a1e78c27699229431412c4b425/scipy-1.1.0-cp36-none-win_amd64.whl#sha256=698c6409da58686f2df3d6f815491fd5b4c2de6817a45379517c92366eea208f (from kwant==1.3.2):
Expected sha256 698c6409da58686f2df3d6f815491fd5b4c2de6817a45379517c92366eea208f
Got 7072c63cb59028a73b639b354c0054525b002ef2d87a1d45ed7cdeba736b5cc6
numpy>=1.8.1 from https://files.pythonhosted.org/packages/af/e4/7d7107bdfb5c33f6cf33cdafea8c27d1209cf0068a6e3e3d3342be6f3578/numpy-1.14.3-cp36-none-win_amd64.whl#sha256=560e23a12e7599be8e8b67621396c5bc687fd54b48b890adbc71bc5a67333f86 (from kwant==1.3.2):
Expected sha256 560e23a12e7599be8e8b67621396c5bc687fd54b48b890adbc71bc5a67333f86
Got 143abb1baa1e5a3427ed09a4f52223aa3947bf76ca25dc4c71da0c2ae663040a
as i said I have updated scipy and numpy packages
so how could i update the HASHES so i can use kwant package
use this to install ,no-cache-dir
pip install --no-cache-dir kwant-1.3.2-cp36-cp36m-win_amd64.whl
it means to no use cache to do install , i also get it when i use window 10 .have fun,fix it

Syntax error when trying to import Cntlr from arelle module

My goal is to use Arelle (open-source platform for XBRL community) to parse XBRL docs from the SEC.
I am following instructions found here.
I successfully git cloned Arelle's code into the Lib directory of Anaconda. However, when I try from arelle import Cntlr I get the following syntax error.
File "arelle\Cntlr.py", line 573
print(logEntry, file=file)
^
SyntaxError: invalid syntax
I am using Python 2.7.12. in Anaconda.
Any feedback is appreciated and I can provide further information upon request.
The instructions you found are rather old (from 2014), and appear to be outdated.
I was able to install the package with the following steps:
# This is needed because the 3to2 library can't be installed as an egg; if
# you don't install it with `pip` first the installation of Arelle will fail.
$ pip install 3to2
# Install Arelle directly from GitHub, this will take a while
$ pip install git+https://github.com/Arelle/Arelle
With 3to2 installed, the installation script setup.py proceeds to translate the Arelle sourcecode back to a Python 2 compatible form. Translation takes several minutes, be patient.

Having Trouble Installing Python Packages With pip

I am relatively new to python and trying to install the base64 package through my cmd (that is system32/cmd.exe <- not sure if this is relevant).
I am using python 2.7.12 64 bit pip 9.0.1
My code is:
pip install base64
My error is:
Could not find a version that statisfies the requirement base64 (from versions : )
No matching distribution found for base64
I was successfully able to install the datetime package, but I received the above error when trying to install pprint. So it is not directly related to base64.
Will be happy to post any other needed information at request, please give me a general idea how I can track down the information needed to solve this problem.
The pip error message means that the package was not found. Typically that means the package name is not correct. In your case, the package is imported import base64 but the actual package name is pybase64:
pip install pybase64
In similar cases you can find the correct package name by using google, for example with 'install base64 python'

Categories