Using pip with pip-installed mercurial - python

So I installed Mercurial with:
pip install mercurial
Now, when I am doing:
pip install -r requirements.txt
I get:
> Cannot find command 'hg'
Is there any way to make pip use c:\python27\scripts\hg.bat as the hg command? I can run it simply by typing hg, so I assumed that pip would also.
I did try using:
mklink c:\windows\system32\hg.bat c:\python27\scripts\hg.bat
And:
mklink c:\windows\system32\hg.exe c:\python27\scripts\hg.bat
Neither with any affect.
I have looked elsewhere on Google, and every answer concerning hg assumes that you've either used apt-get or the installer to get Mercurial installed.
If there is a way to use the mercurial available with pip, I'm thinking that the initial setup of any Windows development environment would go quicker.
I am using Windows 7 (32-bit Python 2.7.10).
Thanks in advance for any help.

Related

Installing pip and numpy on Unix server without root access

I know this question has been asked and answered a number of times but none of those solutions have worked for me. I have installed Python 2.7 into a local directory and added it to my path. When I try to install numpy i get the following error:
ImportError: No module named setuptools
I cannot simply sudo apt-get install python-setuptools because i don't have root access.
I need to install numpy and ideally have pip working for future applications.
0) Try to install packages that are isolated to the current user, use the --user flag:
pip install --user SomeProject
1a) I agree with #Pi Marillion here, use an isolated conda environment if you don't have root access. This way you keep your path clean.
To install conda:
Since I don't know about your OS, go to https://docs.conda.io/en/latest/miniconda.html
After installation, update your conda (just in case):
conda update conda
To list the installed packages, you can do
conda list
You should see python installed. you can start an interpreter by typing python in the terminal.
There's conda cheat sheet that I found incredibly helpful:
https://docs.conda.io/projects/conda/en/latest/user-guide/cheatsheet.html
b) Now try installing via pip and I think you might need python 3.x for setuptools.
https://packaging.python.org/tutorials/installing-packages/#id13
2) If this does not work you can still try
https://packaging.python.org/guides/installing-stand-alone-command-line-tools/
Hope this helps :)
First try easy_install --user setuptools pip. If that doesn't work you need to install things manually.
Download setuptools-*.zip from https://pypi.org/project/setuptools/#files. Unzip the archive, cd into the new directory and run python2.7 setup.py install.
Then try pip install. If it still doesn't work reinstall pip: download get-pip.py and run python get-pip.py --user.

how to install GEM package availble for python in GitHub?

I want to install a python package availble in GitHub (https://github.com/palash1992/GEM) named GEM (graph embedding methods). but I dont know how and from which point should I start. Can anyone give a step by step installing instruction? I dont have git on my computer. Should I have install it first? For more information I have python 3.7 version on my system.
I already tried using: pip install GEM command in cmd.
pip install git+git://github.com/palash1992/GEM.
Non of them worked.
As #Tino said, your answer could be in the GitHub readme file. Here are the instructions:
The package uses setuptools, which is a common way of installing python modules. To install in your home directory, use:
python setup.py install --user
Just copy and paste the above line into your command prompt and you should be fine.

How to download and install pip for python in two steps?

I have a strange situation where I have a normal user account on windows where I have access to the internet and then an admin account without internet access.
Given this, how can I split the installation of easy_install and pip into two steps and get it installed on my machine?
I usually do the following:
Download get-pip.py from https://pip.pypa.io/en/stable/installing/
Run it using python get-pip.py
You're done!
Of course, with the latest version of Python, pip is included, I believe.
You can combine as follows:
pip install -d <dir-name> <package-name>
pip install -f <dir-name> --no-index <package-name>
The 1st one will download the packages locally and the 2nd one will install them. Make sure you create the directory first.
That was simple.
Figured out that pip is installed automatically with python 2.10 and upgraded it to solve the problem!

pip installs packages, but doesn't mark them as executable, so python doesn't find them

I've been trying to use sudo to install python packages on a system that I am on the sudoers list, but don't have general root access (i.e. don't have the password for su). I can install packages, for example
sudo pip install django
however when I try and use them python simply claims not to have the package installed. Investigating the contents of /usr/lib/python it appears that other packages directories and .eggs have executable permissions for ugo, however the packages I install using sudo pip do not have this permission. Manually giving these files executable permissions fixes the problem, but that is laborious, particularly when pip installed several dependencies that I need to chase up.
Is this a known issue? What can I do about it? For the record this is a RHEL6.4 machine and I'm using pip 1.4.1.
You best bet is virtualenv Do your workaround to install the virtualenv.
sudo pip install virtualenv
Resources for virtualenv to get you started:
http://simononsoftware.com/virtualenv-tutorial/
http://www.virtualenv.org/en/latest/

Mercurial error *** failed to import extension hggit: No module named hggit

I installed Mercurial on my Mac, and it's wonderful. For me it's easier to grasp than Git so I wanted to use it to manage git-repositories. Therefore I installed hg-git with the following instructions:
http://hg-git.github.com/
However, each time I issue a hg command it returns this error message:
Mercurial error *** failed to import extension hggit: No module named hggit
It might be important to note that I'm on a Mac not Gnu/Linux or MS-Windows.
Does any one know how to resolve this?
Note for ubuntu users who install the "mercurial-git" package to get the hggit module on 12.04 some bright spark randomly renamed the module to just "git" so you need to change your ~/.hgrc to look something like
[extensions]
hgext.bookmarks =
git =
After installing hg-git with the following command:
easy_install hg-git
Does the following work?
python -c "import hggit"
What does this say for you:
head -n1 `which hg`
The point of the latter command is to verify that the Python hg runs under has hggit installed. In my case it says '#!/usr/bin/python', which is my standard python command.
What does this say:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.a­pp/Contents/MacOS/Python -c "import hggit"
I installed Python and TortoiseHg by:
brew cask install python
brew cask install tortoisehg
After following installation
sudo easy_install hg-git
I experienced similar problems (TortoiseHg: failed to import extension hggit: No module named hggit and so on...) and finally found a solution for my TortoiseHg on mac (first uninstall last hg-git by sudo pip uninstall hg-git):
sudo pip install mercurial
sudo pip install hg-git
After installation with pip and adding bookmarks to all important branches, e. g. ...
hg bookmark -r default master
hg bookmark -r branchename bookmarkname
... I could push HG repository to Git:
hg push git+ssh://git#gitlab.URL/reponame.git --traceback
Note: use ssh! - causes fewer problems with large repositories
Note 2: --traceback tells you about problems
I got this error as well even after downloading the latest Tortoisehg and making sure the hggit plugin was installed as well as my .ini & hgrc files had the right entry to enable hggit.
Turns out my problem was that I had both mercurial and tortoisehg in my path. So when I ran any hg commands, it was using the hg.exe in mercurial folder as opposed to the hg.exe in the torsoisehg directory.
This makes sense but my mercurial installation did not have the plug ins. My fix was to remove mercurial from my path so hg commands go through the tortoisehg directory since it has hg completely bundled. Note however, the recommended option might be to upgrade mercurual to a version that has the plugins that one needs but this is what worked for me. I tried replacing the library.zip in mercurial with the one in tortoisehg and this worked but it led to other errors as one would imagine.
I had the same problem as I saw via brew install mercurial some packages are missing.
Do a test if any package missed like: python -c "import hggit"
My fix: Uninstall all packages:
brew uninstall mercurial
install with pip like:
sudo easy_install pip ( if you don't have pip )
sudo pip install mercurial and
sudo pip install hg-git
then
hg bookmark -r default master
I had the same problem, and found that installing hg-git and dulwich via easy_install worked if I used the --user option. This installed the package into ~/Library/Python/2.7/lib/python/site-packages.
To see where this option will install a package on your machine, run easy_install --help. By the documentation for the --user option, it shows the install directory that will be used.
clone hggit from http://bitbucket.org/durin42/hg-git
get hg-git path from your local computer. in my local computer /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
add path to ~.hgrc file using your text editor
add the following lines of code
[extenstions]
hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
try to hg clone/push/pull form github

Categories

Resources