Fatal error while installing keras - python

I was trying to install keras (for using LSTM) on my Windows 10 system in Anaconda using the method provided by Yelaman. But after running the command pip install git+git://github.com/Theano/Theano.git, I received the following fatal error -
C:\Anaconda>pip install git+git://github.com/Theano/Theano.git
Collecting git+git://github.com/Theano/Theano.git
Cloning git://github.com/Theano/Theano.git to
c:\users\krishna\appdata\local\temp\pip-reettr-build fatal: protocol
error: bad line length character:
Er
Command "git clone -q git://github.com/Theano/Theano.git
c:\users\krishna\appdata\local\temp\pip-reettr-build" failed with
error code 128 in None
I don't have a github account but i use git using bitbucket (if that matters).
Could anyone explain to me what error I am committing and if there is a way out? My main goal is to use keras in Anaconda in Windows.
Thanks!

It seems that the error may be because we have a git repository listed as a dependency. Not still fully sure, though. (Source)
The solution is to replace pip install git+git://github.com/Theano/Theano.git with pip install git+http://github.com/Theano/Theano.git i.e. replacing the second git with http (this works since the repository is public)

Related

Pip install from Github broken after Github keys policy update

I would normally install a Python repository from Github using (for example):
pip install git+git://github.com/Artory/drf-hal-json#master
And concordantly, my "requirements.txt" would have git+git://github.com/Artory/drf-hal-json#master in it somewhere.
This failed today. The full traceback is below, but the relevant part is:
The unauthenticated git protocol on port 9418 is no longer supported.
Thanks Microsoft. The traceback points to this link about the update. Most of the page at the link talks about how the update is unlikely to affect many people (thanks again Microsoft), and the rest of it involves cryptography that I'm far too noob to understand. The section titled "git://" simply reads:
On the Git protocol side, unencrypted git:// offers no integrity or
authentication, making it subject to tampering. We expect very few
people are still using this protocol, especially given that you can’t
push (it’s read-only on GitHub). We’ll be disabling support for this
protocol.
This doesn't help me understand how to update my requirements.txt to make it work again. Can you tell me how to update my requirements.txt to make it work again? Full traceback below:
(venv) neil~/Documents/Code/web_app$ pip install git+git://github.com/Artory/drf-hal-json#master
Collecting git+git://github.com/Artory/drf-hal-json#master
Cloning git://github.com/Artory/drf-hal-json (to revision master) to /tmp/pip-req-build-zowfe130
Running command git clone -q git://github.com/Artory/drf-hal-json /tmp/pip-req-build-zowfe130
fatal: remote error:
The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
WARNING: Discarding git+git://github.com/Artory/drf-hal-json#master. Command errored out with exit status 128: git clone -q git://github.com/Artory/drf-hal-json /tmp/pip-req-build-zowfe130 Check the logs for full command output.
ERROR: Command errored out with exit status 128: git clone -q git://github.com/Artory/drf-hal-json /tmp/pip-req-build-zowfe130 Check the logs for full command output.
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/home/neil/Documents/Code/web_app/venv/bin/python -m pip install --upgrade pip' command.
In the URL you give to pip, the git+git says to access a Git repository (the first git) over the unauthenticated git protocol (the second git). Assuming you want to continue to use anonymous access here, you can simply rewrite the command to use git+https instead, which access a Git repository over the secure HTTPS protocol.
So your command would look like this:
$ pip install git+https://github.com/Artory/drf-hal-json#master
I just tested in a VM, and that appears to work. If you have other such URLs, changing the same way should be effective.

Trying to install a tool from GitHub, but getting lots of errors

I am trying to install pdfminer from GitHub, and I am encountering some errors.
This threw an error:
pip install git+git://github.com/pdfminer/pdfminer.six
This threw an error:
pip install git+https://github.com/pdfminer/pdfminer.six
This threw an error:
git clone https://github.com/pdfminer/pdfminer.six
I googled for a solution online and found the ideas, listed above, from here:
How to install Python package from GitHub?
Those commands seemed to work for several other people, but these don't work for me. I am trying to run these three commands in the Anaconda Prompt. I am using Python 3.6.
Maybe something is not configured correctly on my side, but I can't imagine what it is. Or, is it something else?
BTW, here are the errors that I get:
(base) C:\Users\Excel>pip install https://github.com/pdfminer/pdfminer.six
Collecting https://github.com/pdfminer/pdfminer.six
Downloading https://github.com/pdfminer/pdfminer.six
\ 102kB 1.3MB/s
Cannot unpack file C:\Users\Excel\AppData\Local\Temp\pip-unpack-6kqx4igo\pdfmi
ner.six (downloaded from C:\Users\Excel\AppData\Local\Temp\pip-req-build-2bpsgsh
0, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of C:\Users\Excel\AppData\Local\Temp\pip-req-bui
ld-2bpsgsh0
(base) C:\Users\Excel>pip install git+https://github.com/pdfminer/pdfminer.six
Collecting git+https://github.com/pdfminer/pdfminer.six
Cloning https://github.com/pdfminer/pdfminer.six to c:\users\excel\appdata\loc
al\temp\pip-req-build-iqvj3zbl
Error [WinError 2] The system cannot find the file specified while executing c
ommand git clone -q https://github.com/pdfminer/pdfminer.six C:\Users\Excel\AppD
ata\Local\Temp\pip-req-build-iqvj3zbl
Cannot find command 'git' - do you have 'git' installed and in your PATH?
(base) C:\Users\Excel>git clone https://github.com/pdfminer/pdfminer.six
'git' is not recognized as an internal or external command,
operable program or batch file.
I don't think you're cloning the correct url. You're getting the same "could not unpack" error as the question you linked, hinting that it might be the exact same problem.
Try:
pip install git+https://github.com/pdfminer/pdfminer.six.git
or
pip install git+git://github.com/pdfminer/pdfminer.six.git
Typically git repos end with .git, and when I added it to my clipboard from github that's the url I got.
You could also try pip install pdfminer.six, which I copied directly from their documentation: https://github.com/pdfminer/pdfminer.six/blob/master/README.md

Error while installing pip using get-pip.py with Python2.7.10

I am using Python2.7.10 on a Windows10 machine, and wish to install pip.
I followed the instructions from here to get the get-pip.py file, but when I try to run it I get the following error:
Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
I found that if I install an older version of pip (for Python2.6) then the installation is successful, and I can use pip regularly. If I try to use this older version (9.0.3) to install the newer one (18.0) then I get the same error message.
The complete log of the installation is below (1). If I manually install setuptools then I get the same message when it tries to download the next package:
Any assistance with installing the newer version will be much appreciated :-)
1)
C:\Python27\Lib\site-packages>python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
1% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Update: after installing several packages manually I was able to install the new pip version. It obviously didn't solve the problem, and pip is still not working. When trying to use it, the same error message appears at every attempted download. See log at (2). I double checked the address, and it appears to be correct.
2)
Collecting Requests
Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
11% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Thanks
tl;qr - add the quiet flag (-q) to your command
While trying to debug I redirected the output to a file:
python -m pip install requests > .\temp.txt
Surprisingly, everything suddenly worked!
It appears there is a known bug (Thanks Matan M) while displaying the progress bar to the console. Basically, any solution that would avoid writing it would work.
Here are some options:
Use the -q flag
Turn off the progress bar using --progress-bar off
Redirect to a temp file
:-)
Hi check if you added the relevant python paths to the PATH.
pip install <package> -q **or**
--progress-bar off

Unable to install the python module aubio from github, or from pip

For pip:
In my command prompt I type in:
C:/Python/Scripts/pip install aubio
Recommended by this site:
http://aubio.readthedocs.io/en/latest/python_module.html
And get this message:
http://imgur.com/a/vZxXg
It was suggested that I download a C++ compiler for Python, but doing so hasn't prevented the error.
So I tried installing the module via github.
For Github via pip:
I naturally installed Github and went back to my command prompt.
I typed in:
C:/Python/Scripts/pip install git+git://git.aubio.org/git/aubio
And when that failed:
C:/Python/Scripts/pip install git+git://git.aubio.org/git/aubio.git
I get the error:
Error [WinError 2] The system cannot find the file specified while executing c
ommand git clone -q git://github.com/aubio/aubio.git C:\Users\luke\AppData\Local
\Temp\pip-ornio5sm-build
Cannot find command 'git'
A lot of the other questions had answers concerning a broken setup file, but I'm not entirely sure how I check for that.
Thanks.
So this isn't the whole answer, but it will help anyone who comes here in the future.
I installed Github and not git. That's why the git command isn't recognized.
The correct place for installation[WINDOWS] is: https://git-for-windows.github.io/

Trying to install PyCrypto on Ubuntu via Buildout, src/config.h: No such file or directory

I'm trying to install PyCrypto on an Ubuntu instance via Buildout (via easy_install) and I'm getting the following error:
Getting distribution for 'pycrypto>=1.9'.
Running easy_install:
/usr/bin/python "-S" "-c" "import sys,os;p = sys.path[:];import site;sys.path[:] = p; [sys.modules.pop(k) for k, v in sys.modules.items() if hasattr(v, '__path__') and len(v.__path__)==1 and not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))];from setuptools.command.easy_install import main;main()" "-mUNxd" "/opt/rocktech/buildout/cache/eggs/tmppKIfK7" "-Z" "/opt/rocktech/buildout/cache/download/dist/pycrypto-2.4.tar.gz"
path=/opt/rocktech/buildout/cache/eggs/setuptools-0.6c12dev_r88846-py2.6.egg
Processing pycrypto-2.4.tar.gz
Running pycrypto-2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dD_8Pu/pycrypto- 2.4/egg-dist-tmp-_d3xDl
error: Setup script exited with error: src/config.h: No such file or directory
An error occurred when trying to install pycrypto 2.4. Look above this message for any errors that were output by easy_install.
While:
Installing django.
Getting distribution for 'pycrypto>=1.9'.
Error: Couldn't install: pycrypto 2.4
Any idea on what's causing this?
Notably, I had the same issue locally on Snow Leopard and I was able to fix it by downloading the code directly and running python manage.py build and python manage.py install by hand. I want to avoid that here because I'm deploying to a dozen servers.
Even with the newest pycrypto I keep having this problem, so I just run ./configure and the src/config.h is created, so now just run pip or, easy_install or, setup.py...
You can also download pycrypto-2.4.tar.gz unpack it and run (as root):
./configure
python setup.py install
After that pycrypto will be installed into /usr/lib/python2.7/site-packages/Crypto. I tested it on 'easy_install pysnmp'.
It appears this is an open issue. The workaround is to use pip instead or stick to PyCrypto 2.3. https://bugs.launchpad.net/pycrypto/+bug/881130
EDIT: This bug was fixed in PyCrypto 2.4.1.
Just as an update, PyCrypto has since resolved this issue as you can see from the ticket being marked "Fix Resolved": https://bugs.launchpad.net/pycrypto/+bug/881130. Just an FYI, in case someone comes across this later. This "should" be a non-issue now.

Categories