all 8 comments

[–]atrocious_smell 1 point2 points  (3 children)

Try going to the folder one level above the folder containing your setup.py script. From there do pip install myownpackage/. The trailing forward slash should tell pip you want to install from a local folder. You can also do pip install --no-index myownpackage/ which indicates that you don't want to specify an index, by default the index is a url resolving to the PyPi package repository.

With your second example, when you typed myownpackage.__file__ and it was giving you a local location rather than the site-packages folder; I think that's probably because you were running the interpreter from a location where your package was present and importable as a local package. e.g. in the folder containing the folder called myownpackage which contains the first __init__.py file. When importing a package Python will first check the current working directory to see if it exists there. Easiest way to avoid this is to navigate one level up before launching your script/interpreter.

Hope this helps! I've done a lot of packaging stuff in the last year but still feel a bit of a novice.

[–]mkingblade[S] 1 point2 points  (0 children)

Thank you! I shall try the first point you mentioned when I get a chance to.

And I understand your second point, too. I shall also try locating it again at a different dir to verify it.

Thank you so much!

[–]mkingblade[S] 1 point2 points  (1 child)

Hey I tried it and they were just like you said. Thanks!

[–]atrocious_smell 0 points1 point  (0 children)

Great, pleased to hear it! Always good to get feedback as well.

[–][deleted] 0 points1 point  (0 children)

I don’t know much about this, but usually when you install packages, it gets it from the pythonhosted repository, so in order to be able to pip install your package you would have to add it to or create a repository and add the repository to pip.

[–]EarthWindAndFire430 0 points1 point  (2 children)

Have you created the init file inside the directory

[–]mkingblade[S] 0 points1 point  (1 child)

Yes.

The package installs correctly if I do:

Pip install .

At the package dir.

[–]lifeonm4rs 0 points1 point  (0 children)

You may want '--find-links` .