49

I'm working on a project and need a little different functionality from the package sklearn. I've forked the repo and pushed my changes. I know that I can install from github via pip:

pip install git+git://github.com/wdonahoe/scikit-learn-fork.git@master

and then I can install the package with setup.py:

python setup.py install

However, I am confused about what to do after this step. Running setup.py creates some .egg-info folders and .egg-links files in .../dist-packages/, but I am unsure what to do with them. Ideally, I'd like to go into my project in .../projects/my_project and say something like

from sklearn-my-version import <stuff> 

or switch it out with just

from sklearn import <stuff>

I am also a little confused because a lot of resources on this issue mention using easy_install, which I thought pip replaced.

wdonahoe
  • 1,043
  • 1
  • 10
  • 22
  • 4
    First, you don't want to do both installs on the same package. Either `pip install git+…` or `python setup.py install` (or `pip install .`), not both. – abarnert May 17 '15 at 20:58
  • Meanwhile, either one of those will install the package into your (system, user, or virtualenv) dist-packages or site-packages. (It doesn't go anywhere inside your project. If that's what you think you want, most likely what you actually want is a virtualenv.) You can just `import` the package the same way as any other package. Assuming it installed as `sklearn`, you can just do `from sklearn import `, which sounds like exactly what you want to do, so what's the problem? – abarnert May 17 '15 at 21:00
  • 2
    Finally, the reason "a lot of resources" mention `easy_install` is that a lot of resources are years out of date. If you're reading old StackOverflow answers, blog posts, printed books, etc., they're unlikely to have been updated since they were initially written. – abarnert May 17 '15 at 21:01

1 Answers1

48

try again using just (-e flag lets you git pull updates by installing it as a git repo)

pip install -e git+git://github.com/wdonahoe/scikit-learn-fork.git@master#egg=scikit-learn

more on eggs: http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/

jnshbr
  • 759
  • 9
  • 14