Error installing from GitHub using pip on Windows - python

I am on a Windows machine and I want to install a Python module from GitHub using pip directly from IPython.
The simplest command that seems it should work is:
!pip install https://github.com/japerk/nltk-trainer.git
I have also tried:
!pip install https://github.com/japerk/nltk-trainer.git#egg=nltk-trainer
I've used variants including -vvv, etc.
However, I'm getting the following error. Why?
Cannot determine archive format of C:\Users\timo\AppData\Local\Temp\pip-build-183bwemw\nltk-trainer

go to the https://github.com/japerk/nltk-trainer and download the project zip file. extract the zip file and put it somewhere in your computer.
open command prompt in windows and go inside the folder that you extracted earlier(you must be in the folder that has setup.py file in it).
enter the following command: python setup.py install
python tries to install nltk-trainer . during installation some other dependency might be installed too. you need numpy and scipy to be installed. if any problem happened during installation of numpy or scipy try installing them manually first by using pip install numpy and pip install scipy
if you can't install numpy and scipy using pip command use the following link:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
this site has compiled version of these libraries ( and other libraries if you need to install them too) you can download .whl file that is based on your python version and os architecture and install them using pip install filename.whl command ( you need to be in the folder that your whl file is) for example for python3.4 and 64bit operating system you may download scipy‑0.16.0‑cp34‑none‑win_amd64.whl file.

Related

Install packages with conda - channel error

I am new to Python and Conda. I am trying to install a package called DavGIS. I downloaded this package and I downloaded Anaconda. Then I opened Anaconda Prompt and tried to install the package with the command conda install davgis. This gave an error message regarding not begin available on current channels.
Then I tried pip install davgis, but this gives an error as well. In the picture the commands and errors are showed. I am using Windows 10 64-bit and Anaconda with Python 3.6
Errors installing package:
You cannot install this package, because there is no package. A python package contains a file called "setup.py". And to install it with pip (or conda) it need to be referenced on their server.
If you want to use it in your project, you can copy it directly in your source folder (where your code is).
If you wanna do it without copying, you can follow this method: How to install Python module without setup.py?

Syntax Error from 'pip install' in python + command line

Okay, so, I'm running Python 3.4.3 with pip 9.0.1, with the setuptools and wheel.
I'm running this inside JetBrains PyCharm Professional 2017.2.3.
The issue I'm having is trying to install the twitter api packages from this tutorial (ya I'm a n00b) http://wiki.openhatch.org/Twitter
I'm struggling with installing the 4 dependencies mentioned in the first part of the tutorial (httplib2, simplejson, oauth2 and python-twitter)
Honestly, I'm just getting back into programming and this is a project I'd like to complete.
So, I need help with:
Installing pip, and how to use it, and where (python shell or command line or)
the dev.twitter.com website (and where to find what I need from there)
Any help is massively appreciated and sorry if I sound really n00by, but do correct me where I'm using incorrect terms etc because that's how I learn I guess :)
If you haven't got pip installed, find your python installation file.Execute it and choose 'Change Python Installation'. Now choose 'pip' to install and 'add python.exe to path'. Wait for it to finish. Now run windows command line and type:
pip install package_name
Sometimes you may experience that a package isn't available on pip or doesn't work.There are 2 common (not always working) ways to install a package without making pip download the file:
1) A package may be available as a .whl file for download.Download it.Now find it and copy its name .Open a command line in dictionary where it is located and type
pip install **now paste the filename and add .whl**'
2)A package is available as a zip file.Packages are often packed into a zip file.Download the file and extract it.Open a command line in it's directory.You may see setup.py file.Run
python setup.py install
When finished installing pip and adding python to path,you can run:
pip install httplib2 simplejson oauth2 python-twitter
Done.
Once you have pip installed, open the command prompt and just type pip install name_of_the_extension.
In this case, pip install httplib2 will install this package.
I believe you have pip installed on your computer, so it shouldn't be a problem to install the 4 packages you need.

How to install gensim on windows

Not able to install gensim on windows.Please help me I need to gensim Immediately and tell me installation steps with More details and other software that needs to be installed before it. thanks
First you need to install NumPy then SciPy and then Gensim (assuming you already have Python installed). I used Python 3.4 as I find it easier to install SciPy using version 3.4.
Step 1) Install Numpy:
Download numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl from here
note that in cp34-cp34m 34 is version of Python you are using. So download appropriate file
Open command prompt and go the folder in which you just downloaded the file and install Numpy using following command:
pip install numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl
You should get successfully installed numpy message
Step 2) Install SciPy:
Follow the same link as above and download the scipy‑0.19.1‑cp34‑cp34m‑win32.whl file.
Install it using the same instructions than in Step 1 but with this file name. The command is the following:
pip install scipy‑0.19.1‑cp34‑cp34m‑win32.whl
You should get this message successfully installed scipy
Step 3) Install gensim:
Follow the link in step 1 and download gensim‑2.3.0‑cp34‑cp34m‑win32.whl (the appropriate version for your system)
Install it using the instructions in Step 1 (with this file name) with following command:
pip install gensim‑2.3.0‑cp34‑cp34m‑win32.whl
You should get this message successfully installed gensim
Now in a Python shell try:
import gensim
It should be successfully imported
NOTES:
Make sure pip is in your environment variables (add C:\python34\scripts to your environment variable).
Make sure to download all the packages according to the Python version you are using.
gensim depends on scipy and numpy.You must have them installed prior to installing gensim. Simple way to install gensim in windows is, open cmd and type
pip install -U gensim
Or download gensim for windows from
https://pypi.python.org/pypi/gensim
then run
python setup.py test
python setup.py install
I struggled with this a bit today trying to figure out if I needed a python 2.7 environment or if I could use my 3.5. I ended up doing this from an Anaconda 3.5 install:
conda install -c anaconda gensim=0.12.4
After a few hours of trying various things, suddenly it all worked on 3.5. My error was that it kept failing to install Scipy. I tried starting over with the conda install and just worked.
See: https://anaconda.org/anaconda/gensim
I strongly suggest using anaconda where the installation of all the packages is very easy.
The command for installing genism and all of its necessary packages on windows using anaconda python 3.7 is below.
conda install -c anaconda gensim
I followed the instruction on https://radimrehurek.com/gensim/install.html which then successfully installed the fast version of Gensim (3.8.0) on Windows:
conda install -c conda-forge gensim
PS:
The following did NOT install the fast version on Windows:
conda install gensim
After attempting some of the above ideas, there was still a "hiccup" with gensim but the error was something else related to punkt. The following (where the interest is the second line)...
import nltk
nltk.download('punkt')
import numpy
import scipy
import gensim
...did the trick. I used conda and not pip but do not believe that mattered.
Versions: latest python
Machine: Windows 10 (latest updates as of 8/2020)

How to start using `scipy`

I have previously installed Python 3.4.2 and 3.5.2 and in both cases I can dabble in writing and testing code in Idle which gives me two windows -- a "Run" window for code, and a "Shell" window for interaction and output (sorry, not sure of the correct terminology).
Now I'd like to try out scipy, particularly scipy.spatial.
First, I downloaded WinPython (WinPython-64bit-3.4.3.6Qt5.exe) from sourceforge.net/projects/winpython/files/ but when I tried to install it, it wanted to put it in my Downloads folder (where the installer was saved, obviously) so I browsed to Program Files and tried to install there but I get
Error opening file for writing
C:\Program Files\WinPython-64bit-3.4.3\IDLE (Python GUI).exe
Same response at C:\Program Files (x86)\.
Next, I downloaded just scipy-0.16.1-win32-superpack-python3.4.exe and it seemed to be successfully installed until I try to run import scipy in my usual "Run" window I get
ImportError: No module named 'numpy'.
Third, I retried WinPython-64bit-3.4.3.6Qt5.exe again, but this time accepting the default Downloads install location. This time there was a successful installation of python-3.5.1.exe in Downloads. When I ran it I chose "Repair" and eventually got "Repair was sucessful." However, when I try to run import scipy in my usual "Run" window I get
ImportError: No module named 'scipy'.
What steps am I missing? What is the easiest way for me to try using scipy?
Assuming you have correctly installed Python, you can try using the .whl (wheel) files available on the LFD's website.
First, make sure you have an updated version of pip which supports the use of .whl files by using the following command in the terminal:
python -m pip install -U pip
Then, download the latest versions of the .whl files for NumPy and SciPy into some directory you can easily locate.
Afterwards, use the following command to install the .whl files you've downloaded in the necessary order:
python -m pip install C:/path/name-of-file.whl

Installing numpy for Python 2.7 while also having Python 3.4 installed?

I have both Python 2.7 and Python 3.4 (and have to have both because for the class I'm running, students have the option of using either). One student has used Python 2.7 and numpy for their project, but when I attempt to install numpy, it installs it to 3.4. I need to install it to 2.7.
I'm using numpy 1.9 from this site, which I'm told is also 2.7-specific: http://sourceforge.net/projects/numpy/files/NumPy/
However, nonetheless it still goes to the 3.4 folder. Copying it to Python 2.7 didn't work, obviously.
How do I do this?
I recommend installing with pip.
pip install numpy
If this doesn't work on windows then download the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and convert it to a wheel before installing.
pip install wheel
wheel convert path/to/binary
pip install numpy_wheel
Pip is recommended because you can uninstall.
To check where you are installing to
pip -V
You may have an environmental variable path to the wrong pip.
Assuming that you are using, or at least you should use pip to install the library. You can specify the python version to be installed by changing the suffix, e.g. pip-2.7 install numpy.
pip install numpy
pip-2.7 install numpy
pip-3.4 install numpy
As an alternative, in case that you do not want to use pip is to download and install the library using setup with a similar technique.
python setup.py install
python2.7 setup.py install
python3.4 setup.py install
Your PATH isn't setup correctly.
C:> where pip
Should tell you which pip it is trying to use, and it is likely whichever one it found on your PATH first...
So, instead, you will want to run it as
C:> C:\mypython2install\pip.exe install numpy
Or, setup your path correctly. See here
Just one other note on issues like this. I had a similar problem with Python 2.7 libraries not being found, because I had miniconda installed for a Python virtual environment that was hijacking calls to python from other programs. After deleting the minconda directory in my home the problem went away and python libraries that were properly installed were found again.
Note-This answer is particularly for Windows PC which has both Python2 & Pyhton3 installed on it.
Both the versions of Python has their different directories somewhat like
"C:\Python27\" ----for python2
"C:\Python35\" ---- for python3
*(or it depends on what path you chose while installing Python**)*
pip GENERALLY exist under the directory "C:\Python**\Scripts"
there you can find exe files like:
pip.exe/pip2.exe/pip2.7.exe ----for python2
pip3.exe/pip3.5.exe ----for python3
to install packages on python2:
use
Python27\Scripts\pip2.exe install package_name
(where the 1st argument is the path of exe file, it might differ for your system)
to install packages on python3:
use
Python35\Scripts\pip3.exe install package_name
there is no need to uninstall any version of python to achieve the task.

Categories

Resources