I have installed aldryn-segmentation using pip and am trying to install aldryn-country-segment using pip install https://github.com/aldryn/aldryn-country-segment/archive/master.zip as the documentation suggests.
However I get an error that it could not find a version that satisfies the requirement aldryn-geoip.
Collecting aldryn-geoip (from aldryn-country-segment==0.7.2)
Could not find a version that satisfies the requirement aldryn-geoip (from aldryn-country-segment==0.7.2) (from versions: )
No matching distribution found for aldryn-geoip (from aldryn-country-segment==0.7.2)
or when downloading file and running python setup.py install it gives me this: (after lots of other text)
Processing dependencies for aldryn-country-segment==0.7.2
Searching for aldryn-geoip
Reading https://pypi.python.org/simple/aldryn-geoip/
Couldn't find index page for 'aldryn-geoip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for aldryn-geoip
error: Could not find suitable distribution for Requirement.parse('aldryn-geoip')
Is there an obvious workaround to this?
Download and save the file somewhere in your system.
Then unzip it and cd to the directory. You'll get something like this:
.
├── addon.json
├── aldryn_config.py
├── country_segment
│ ├── cms_plugins.py
│ ├── __init__.py │ ├── locale
│ │ └── fr
│ │ └── LC_MESSAGES
│ │ ├── django.mo
│ │ └── django.po
│ ├── middleware
│ │ ├── __init__.py
│ │ └── resolve_country_code_middleware.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ └── __init__.py
│ ├── models.py
│ └── south_migrations
│ ├── 0001_initial.py
│ └── __init__.py
├── LICENSE.txt
├── README.md
├── schemamigration.py
└── setup.py
7 directories, 17 files
Then run sudo python setup.py install and python will install the package to your system.
You may need to install aldryn-geoip as dependency too. (using the same way)
Related
I have a private repo on GitHub containing a Poetry package which I install with
poetry add git+https://github.com/<USERNAME>/<REPO>.git#<BRANCH>
This project's structure is (assume it's called package_1)
├── README.md
├── package_1
│ ├── __init__.py
│ ├── subpackage_1
│ │ ├── __init__.py
│ │ └── subpackage_1.py
│ ├── subpackage_2
│ │ ├── __init__.py
│ │ └── subpackage_2.py
│ └── subpackage_3
│ ├── __init__.py
│ └── subpackage_3.py
├── poetry.lock
├── pyproject.toml
└── tests
├── __init__.py
└── test_package_1.py
package_1/init.py is just __version__ = "0.3.3"
When I run poetry add git+https://github.com/<USERNAME>/<REPO>.git#<BRANCH> on a new package, the package_1 package is correctly installed but two things happen which I don't understand:
1: The new package's pyproject.toml file shows package_1's version as 0.2.0 when clearly the version is 0.3.3 as mentioned above;
2: The poetry.lock file looks like this after I install package_name
[[package]]
name = "package-name"
version = "0.2.0"
...
Why is the name package-name instead of package_name (notice the _ and -)?
I have package structure like this:
└── src
├── my_program.py
├── mynamespace-packageone
│ ├── mynamespace
│ │ └── subpackage_one
│ │ ├── __init__.py
│ │ └── first.py
│ ├── mynamespace_packageone.egg-info
│ │ ├── PKG-INFO
│ │ ├── SOURCES.txt
│ │ ├── dependency_links.txt
│ │ └── top_level.txt
│ └── setup.py
└── mynamespace-packagetwo
├── mynamespace
│ └── subpackage_two
│ ├── __init__.py
│ └── second.py
├── mynamespace_packagetwo.egg-info
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ └── top_level.txt
└── setup.py
in setup.py in subpackage_one,
from setuptools import setup, find_namespace_packages
PACKAGE = "mynamespace-packageone"
VERSION = "0.1"
setup(
name=PACKAGE,
version=VERSION,
packages=find_namespace_packages(include=["mynamespace.*"]),
description="subpackage_one"
)
in in setup.py in subpackage_two,
from setuptools import setup, find_namespace_packages
PACKAGE = "mynamespace-packagetwo"
VERSION = "0.1"
setup(
name=PACKAGE,
version=VERSION,
packages=find_namespace_packages(include=["mynamespace.*"]),
description="subpackage_two"
)
I use pip to install these two packages in edit mode
pip install -e src/mynamespace-packageone/
pip install -e src/mynamespace-packagetwo/
in my_program.py
I was trying to import mynamespace.subpackage_one
import mynamespace.subpackage_one
but the syntax shows cannot find module mynamespace.
I cannot figure out what is wrong.
Please help.
Thanks,
Arthur
I have this project architecture and I want to make my_package pip installable. The project doesn't only contain stuff to package but also simple scripts (the quick and dirty kind) and over things that are important in my project but not for the package (external data for example).
my_project
├── code
│ ├── data #<-- I don't want to package this
│ │ └── make_dataset.py
│ ├── script #<-- I don't want to package this
│ │ └── make_experiment.py
│ └── my_package #<-- This is the module I want to package
│ ├── core.py
│ ├── utils.py
│ └── __init__.py
├── data
│ └── some_data.txt
├── references
│ └── reference_paper.pdf
├── reports
│ └── report.tex
├── LICENSE
├── README.md
├── requirements.txt
└── setup.py
I would like the setup.py file to be in the top-level directory so that people can do the usual
git clone gitinstance.com/my_project
cd my_project
pip install .
and get my_package module installed in their environment so they can already do python -c import my_package; print(my_package.__version__) and it works.
The question is: How can I make my_package pip-installable without putting setup.py inside the code directory?
Usually, the setup.py would look like this:
from setuptools import find_packages, setup
setup(
name='my_package',
packages=find_packages(),
version='0.1.0',
description='Research project',
author='Name',
license='MIT',
)
But it wouldn't work here because setup.py can't find my_package.
I found an example in the documentation of setuptools that more or less fit my use-case.
The solution is in the packages and package_dir arguments of the setup function that allows to specify where to find the packages to install. This is usually hidden because it defaults to the current working directory.
In my simple case, the setup.py transforms to:
from setuptools import find_packages, setup
setup(
name='my_package',
packages=find_packages(where="code"),
package_dir={'': "code"},
version='0.1.0',
description='Research project',
author='Name',
license='MIT',
)
How can one command find out all dependencies of the package and links to dependent packages in the repository pip?
You can use johnnydep
pip install johnnydep
Example: johnnydep ipython
ipython IPython: Productive Interactive Computing
├── appnope Disable App Nap on OS X 10.9
├── backcall Specifications for callback functions passed in to an API
├── decorator Better living through Python with decorators
├── jedi>=0.10 An autocompletion tool for Python that can be used for text editors.
│ └── parso>=0.3.0 A Python Parser
├── pexpect Pexpect allows easy control of interactive console applications.
│ └── ptyprocess>=0.5 Run a subprocess in a pseudo terminal
├── pickleshare Tiny 'shelve'-like database with concurrency support
├── prompt-toolkit<2.1.0,>=2.0.0 Library for building powerful interactive command lines in Python
│ ├── six>=1.9.0 Python 2 and 3 compatibility utilities
│ └── wcwidth Measures number of Terminal column cells of wide-character codes
├── pygments Pygments is a syntax highlighting package written in Python.
├── setuptools>=18.5 Easily download, build, install, upgrade, and uninstall Python packages
├── simplegeneric>0.8 Simple generic functions (similar to Python's own len(), pickle.dump(), etc.)
└── traitlets>=4.2 Traitlets Python config system
├── decorator Better living through Python with decorators
├── ipython-genutils Vestigial utilities from IPython
└── six Python 2 and 3 compatibility utilities
You can also display download links to dependant packages by adding the --fields download_link option:
johnnydep ipython --fields download_link
.
name download_link
-------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------
ipython https://files.pythonhosted.org/packages/a0/27/29d66ed395a5c2c3a912332d446a54e2bc3277c36b0bbd22bc71623e0193/ipython-7.0.1-py3-none-any.whl
├── appnope https://files.pythonhosted.org/packages/87/a9/7985e6a53402f294c8f0e8eff3151a83f1fb901fa92909bb3ff29b4d22af/appnope-0.1.0-py2.py3-none-any.whl
├── backcall https://files.pythonhosted.org/packages/84/71/c8ca4f5bb1e08401b916c68003acf0a0655df935d74d93bf3f3364b310e0/backcall-0.1.0.tar.gz
├── decorator https://files.pythonhosted.org/packages/bc/bb/a24838832ba35baf52f32ab1a49b906b5f82fb7c76b2f6a7e35e140bac30/decorator-4.3.0-py2.py3-none-any.whl
├── jedi>=0.10 https://files.pythonhosted.org/packages/7a/1a/9bd24a185873b998611c2d8d4fb15cd5e8a879ead36355df7ee53e9111bf/jedi-0.13.1-py2.py3-none-any.whl
│ └── parso>=0.3.0 https://files.pythonhosted.org/packages/09/51/9c48a46334be50c13d25a3afe55fa05c445699304c5ad32619de953a2305/parso-0.3.1-py2.py3-none-any.whl
├── pexpect https://files.pythonhosted.org/packages/89/e6/b5a1de8b0cc4e07ca1b305a4fcc3f9806025c1b651ea302646341222f88b/pexpect-4.6.0-py2.py3-none-any.whl
│ └── ptyprocess>=0.5 https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
├── pickleshare https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
├── prompt-toolkit<2.1.0,>=2.0.0 https://files.pythonhosted.org/packages/e5/c5/f1ee6698bdcf615f171a77e81ca70293b16a6d82285f1760b388b4348263/prompt_toolkit-2.0.5-py3-none-any.whl
│ ├── six>=1.9.0 https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
│ └── wcwidth https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
├── pygments https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl
├── setuptools>=18.5 https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl
├── simplegeneric>0.8 https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip
└── traitlets>=4.2 https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl
├── decorator https://files.pythonhosted.org/packages/bc/bb/a24838832ba35baf52f32ab1a49b906b5f82fb7c76b2f6a7e35e140bac30/decorator-4.3.0-py2.py3-none-any.whl
├── ipython-genutils https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
└── six https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
EDIT: So, after installing Ruamel.yaml from a local path, uninstalling it and reinstalling it worked perfectly. I have no idea why re-installing it changed anything, but hey, it works.
Please close this question.
Original:
I wanted to install the Ruamel.Yaml module for Python3.4 in
PythonAnywhere. However,if I tried to use PIP3.4 I used to get the following result:
Could not find a version that satisfies the requirement ruamel.yaml (from versions: )
No matching distribution found for ruamel.yaml
Trying to work around that, I downloaded ruamel.yaml-0.11.6.tar.gz
(the file tagged as Source), and install it with PIP3.4 using
the -e flag. Apparently, PIP3.4 told me it was a success, and
trying to re-install the package gives me the following message:
pip3.4 install --user ruamel.yaml
Requirement already satisfied (use--upgrade to upgrade): ruamel.yaml
in /home/<username>/dumpfolder_version3/ruamel.yaml-0.11.6
However, when I try to run the library I get the following error...
Traceback (most recent call last):
File "/home/<username>/mailgun/configurar_menu.py", line 3, in <module>
import ruamel.yaml as yaml
ImportError: No module named 'ruamel'
Do you have any idea what could be the problem?
If I try to reinstall another package python already has, I get this
message
pip3.4 install --user pyyaml
Requirement already satisfied (use --upgrade to upgrade): pyyaml
in /usr/local/lib/python3.4/dist-packages
Could that difference be the problem?
There might be a number of problems, but unfortunately I don't have access to pythonanywhere so I cannot test them out. I do however have some experience with ruamel.yaml and its installation ¹.
The main problem is that you try to install in editable mode, but ruamel is a namespace and pip install -e cannot properly handle that. Unfortunately ruamel.yaml's setup.py currently doesn't catch that (it does if you try to use python setup.py to install), and because of that doesn't warn or correct its behaviour.
Your site-packages directory is probably already messed up so that pip is incapable of restoring, but you can try pip uninstall -y ruamel.yaml. After that check if everything starting with ruamel is removed from your lib/python3.4/site-packages directory and reinstall with pip install ruamel.yaml*tar.gz. The latter is also what you need to do if you start from scratch.
After correct installation on 3.4 you should have the following if you do tree ruamel* in your site-packages directory:
ruamel
└── yaml
├── comments.py
├── compat.py
├── composer.py
├── configobjwalker.py
├── constructor.py
├── cyaml.py
├── dumper.py
├── emitter.py
├── error.py
├── events.py
├── __init__.py
├── loader.py
├── main.py
├── nodes.py
├── parser_.py
├── __pycache__
│ ├── comments.cpython-34.pyc
│ ├── compat.cpython-34.pyc
│ ├── composer.cpython-34.pyc
│ ├── configobjwalker.cpython-34.pyc
│ ├── constructor.cpython-34.pyc
│ ├── cyaml.cpython-34.pyc
│ ├── dumper.cpython-34.pyc
│ ├── emitter.cpython-34.pyc
│ ├── error.cpython-34.pyc
│ ├── events.cpython-34.pyc
│ ├── __init__.cpython-34.pyc
│ ├── loader.cpython-34.pyc
│ ├── main.cpython-34.pyc
│ ├── nodes.cpython-34.pyc
│ ├── parser_.cpython-34.pyc
│ ├── reader.cpython-34.pyc
│ ├── representer.cpython-34.pyc
│ ├── resolver.cpython-34.pyc
│ ├── scalarstring.cpython-34.pyc
│ ├── scanner.cpython-34.pyc
│ ├── serializer.cpython-34.pyc
│ ├── tokens.cpython-34.pyc
│ └── util.cpython-34.pyc
├── reader.py
├── representer.py
├── resolver.py
├── scalarstring.py
├── scanner.py
├── serializer.py
├── tokens.py
└── util.py
ruamel.yaml-0.11.6.dist-info
├── DESCRIPTION.rst
├── INSTALLER
├── METADATA
├── metadata.json
├── namespace_packages.txt
├── RECORD
├── top_level.txt
└── WHEEL
¹ I am the author
As edited above, this was already solved. According to Yamuel's own author, it may have been because the -e flag was messing everything up.