Unable to install git repo by pip - python-3.x

I am trying to install a git repo's master branch source by pip and I am using the command
pip install git+https://github.com/apache/systemml/#master#egg=systemml&subdirectory=src/main/python
But I encountered the error:
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\test\AppData\Local\Temp\pip-install-3hqjwj06\systemml\
'subdirectory' is not recognized as an internal or external command,
operable program or batch file.
So I researched about it and found the StackOverFlow
question and followed the following steps of the most upvoted answer but it didn't work in my case. I also tried installing python 3.6 and it also did not help.
I am using Windows OS and 3.7 python
Any help is appreciated.

Related

Unable to Install Jupyter due to legacy-install-error with psutil package

I was previously running into environment inconsistencies after downloading tensorflow with pip in a conda environment, and after several hours of frustration, decided deleting anaconda/miniconda and python and starting from scratch would be my best option to get python working again (The inconsistencies were causing a plethora of issues with loading other modules like numpy, etc).
After downloading Python version 3.9.10 directly from https://www.python.org/downloads/macos/, I wanted to see if I could start using Python again in a Jupyter notebook in VS Code. When I try to run a simple print('hello world') in a python chunk I (unsurprisingly) get the following error:
Jupyter cannot be started. Error attempting to locate jupyter: Running cells with 'Python 3.9.10 64-bit' requires notebook package.
Run the following command to install 'jupyter and notebook' into the Python environment.
Command: 'python -m pip install jupyter notebook -U'
I was pretty much expecting this error, since I knew I had deleted all packages when deleting Anaconda and Python.
However, when I try running python -m pip install jupyter notebook -U in the terminal I ultimately get the following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psutil
note: This is an issue with the package mentioned above, not pip.
Any help or insight is greatly appreciated! I am on MacOS (M1) if that is useful information.
The problem seems to be with the python3 distribution that comes with MacOSX Command Line Tools. Well, at least that same error was gone after following these steps.
So, to fix the problem I installed python3.9 (I presume you can change 3.9 to your desired version, e.g. 3.8 or 3.10) using Homebrew.
Install Homebrew (to check if it's installed already just type brew --version in the terminal):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install python3.9
brew install python#3.9
Create your virtual environment
python3.9 -m venv myvenv
Activate the virtual environment with source myvenv/bin/activate
Finally, install Jupyter using
(myvenv) pip install jupyter notebook
I have the same problem when installing the Jupyter notebook on MacOS 12.5 M2 chip. It turns out that the error is caused by not having GCC on my mac to run the wheel for installing the psutil package because for some reason I removed my XCode from my Mac. So I installed XCode from AppStore and opened XCode after the installation to agree to its terms and conditions. After Xcode went through the setup process I tried pip install jupyter again and it worked well.
In my case, I just opened the XCode, accept the terms and the installation proposed, and tried to install the jupyter again and it worked!
It seems to be very particular about the version of python installed. I set up a fresh installation on a new box this morning and put 3.11 on there. pip install jupyterlabs gave me the same error as you got. I then uninstalled python and installed an earlier version, and now it works.
PS the older version that worked for me is 3.10.8

import from github repository into Python jupyter notebook

Goal: I want to import this library https://github.com/Kaggle/learntools into a jupyternotebook so that I can use use both the following packages:
from learntools.core import binder
from learntools.machine_learning.ex8 import *
To do this, I tried to two methods to clone the github library with this command.
1st method:
conda install git
pip install auto-py-to-exe
pip install git+https://github.com/Kaggle/learntools.git
2nd method:
%%bash
git clone https://github.com/Kaggle/learntools
Situation/Problem:
1st method gave this error:
WARNING: Discarding git+https://github.com/Kaggle/learntools.git. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2nd method gave this error:
bash: line 1: git: command not found
Question: How can I clone/import this github library https://github.com/Kaggle/learntools into my jupyter notebook so that I can use its packages in the code.
Thank you for taking your time in answering it.
Seems like a really basic step to do, but somehow is not working on my side.
First method
Can't really do much for you since you haven't provided the full log output.
Second method
It looks like you've installed git in your conda environment, but not to your machine as a whole. I believe the instance of bash that is being used for your second method is not using your conda environment. You didn't share your conda environment's name, but if we assume it's gitenv, You could try this:
conda activate gitenv && git clone https://github.com/Kaggle/learntools
However, I'd recommend that you simply install git for your whole machine. I can't think of any reason to have it installed only in a conda environment.
Once you have the repo cloned, you'll have to use pip to install it as a package.

installation of assimulo and sundials - error

I want to use Assimulo and Sundials for the solution of differential algebraic equations in Python and therefore I am trying to install it on Ubuntu.
For the installation of Sundials, I followed the installation instructions and as I understand it worked well.
% cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lib/sundials-3.1.1/ ~/opt/sundials/sundials-3.1.1
% make
% make install
Then I tried to install Assimulo with the command pip3 install Assimulo, but I get an error message. I also tried to follow the instructions on Installation - Assimulo 3.0 documentation by downloading the installation files and install it with the following command. It results in the same error message.
sudo python3 setup.py install --sundials-home=/usr/local/lib/sundials-3.1.1
This is the error message I get:
target build/src.linux-x86_64-3.6/assimulo/thirdparty/hairer/dopri5module.c does not exist:
Assuming dopri5module.c was generated with "build_src --inplace" command.
error: 'assimulo/thirdparty/hairer/dopri5module.c' missing
What is wrong and how can I fix it? Any help would be appreciated!
I got the same error when installing on macos via pip install assimulo, after pip-installing numpy and cython.
For me, using a conda env did the trick:
Creating the conda env: conda create -n your_name_goes_here
conda activate your_name_goes_here
conda install python=3.6 (I noticed you can also use 3.7)
conda install -c conda-forge assimulo
I also had the same error message. As suggested in the other answer, you can get a compiled package from Conda. But if you want to compile from source yourself, it looks to me that PyPI source tarball doesn't contain all needed files. At least some *.pyf files are missing. So, I used SVN repo instead:
svn checkout https://svn.jmodelica.org/assimulo/tags/Assimulo-3.0/ assimulo
By compiling this source tree, I managed to get pass the original error you had, but I'm now having another build error that I don't know yet how to solve:
ssimulo/solvers/sundials.c: In function '__pyx_f_8assimulo_7solvers_8sundials_5CVode_initialize_cvode':
assimulo/solvers/sundials.c:33274:31: error: too many arguments to function 'CVodeCreate'
__pyx_v_self->cvode_mem = CVodeCreate(__pyx_t_3, __pyx_t_4);

Trouble installing using PIP

I'm having trouble importing plotly using pip install. The error I get is as follows:
The following command must be run outside of the IPython shell:
$ pip install plotly
The Python package manager (pip) can only be used from outside of IPython.
Please reissue the `pip` command in a separate terminal or command prompt.
I'm very new to programming, so I simply tried this in the windows command prompt and it said "pip is not recognized as an internal or external command, operable program, or batch file". I'm using Spyder if that helps, but I'm not sure what I'm missing here.
Thanks for your help.
I guess you forgot to put ! before pip.
try:
!pip install plotly
in your notebook, should work.
For windows the cleanest way to install a python package is to:
python -m pip install [packagename]
This removes the ambiguity if pip is added to the path variable or not.
If you are getting below error while installing any python packages in window using command "pip install packageName".
The following command must be run outside of the IPython shell:
$ pip install configobj
The Python package manager (pip) can only be used from outside of IPython.
Please reissue the `pip` command in a separate terminal or command prompt.
See the Python documentation for more information on how to install packages:
https://docs.python.org/3/installing/
solution: add "!" at beginning of pip
!pip install configobj(packageName)
It will work. It worked in my case.
What worked for me was going to the directory in which Spyder is located, which you can do by searching Spyder on your computer and then right clicking → directory, and then in the directory opening the Anaconda Prompt. In this Prompt you can type in:
pip install [packagename]
and it will work.

installing fastkde library in Python

I want to install fastkde library and I did actually everything on web but I am yet able to install this. I constantly get this error in terminal:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4ff4dzcb/fastkde/
Can anybody help me with this?
If you've pip installed which is true for all distributions downloaded from here, then just key in the commands in your terminal given below.
pip3 install fastkde

Resources