jason9693 / MusicTransformer-tensorflow2.0

implementation of music transformer with tensorflow-2.0 (ICLR2019)
MIT License
353 stars 81 forks source link

error:No matching distribution found for python-apt==1.6.4 #5

Open fnyhy opened 4 years ago

fnyhy commented 4 years ago

Hello! My environment (python 3.7) reported a error when I installed libs in the requirement, that is 'No matching distribution found for python-apt==1.6.4'. In fact, some other libs also have this problem.

jason9693 commented 4 years ago

Did you ever tried in 3.6.8? Actually, My python environment is 3.6.8

fnyhy commented 4 years ago

My python environment is 3.6.8 now in anaconda. But the problem still appeared. Collecting bc-dvc-init==0.3.0 (from -r requirements.txt (line 7)) ERROR: Could not find a version that satisfies the requirement bc-dvc-init==0.3.0 (from -r requirements.txt (line 7)) (from versions: none) ERROR: No matching distribution found for bc-dvc-init==0.3.0 (from -r requirements.txt (line 7))

Asuka0002 commented 4 years ago

I wonder if the problem is solved. I have the same problem too, and my python is 3.6.6 in anaconda.

trinitronx commented 3 years ago

Hello! My environment (python 3.7) reported a error when I installed libs in the requirement, that is 'No matching distribution found for python-apt==1.6.4'. In fact, some other libs also have this problem.

This particular module (python-apt) is only available on PyPi with version 0.7.8.

One of the developers & Debian package maintainers for python-apt has stated the following:

Aargh, not this whole PyPI thing again. Nobody ever officially uploaded python-apt there. It is tightly coupled with APT, and not supposed to be distributed in any fashion other than via Debian packages.

There is no, and has never been any support for PyPi. And I can say that I have absolutely no interest in duplicating work there. Source: Debian "Deity" Mailing List 2016-11-22 msg#00094

You can install python-apt from apt, we do not provide python-apt on pip. I recently got control over the pypi entry and need to do something with it. I'm not keen on providing python-apt outside of the distro, though (python-apt and apt versions x.y need to match), so I'd rather just get rid of it, so people stop with questions about outdated versions. Source: python-apt#1883451

So at least for this dependency, it appears that we're out of luck when resolving dependencies python-natively via pip + PyPi. The upstream project is hosted on the salsa.debian.org GitLab instance, and pip supports git+ SCM urls now.

So, perhaps the solution to the python-apt package issue is to use this git+ URL feature in requirements.txt. To further isolate installation from the system OS provided version of python-apt, a virtualenv or pip install --user may be desired.
For example:

requirements.txt:

--index-url https://pypi.python.org/simple/

-e git+https://salsa.debian.org/apt-team/python-apt.git#egg=python-apt
-e .

For a project with setup.py containing:

[...SNIP...] # Boilerplate stuff here

setup(

[...SNIP...] # Other setup() args here

    platforms=['linux'],
    # Reference:
    #  - https://github.com/pypa/interoperability-peps/pull/30/files#r184839487
    # sudo apt install python3-apt apt-rdepends apt
    # os_requires=[
    #     ['python3-apt', type='packagename', target='run', os='ubuntu'],
    #     ['apt-rdepends', type='packagename', target='run', os='ubuntu'],
    #     ['apt', type='packagename', target='run', os='ubuntu']
    #     ['libapt-pkg-dev', type='packagename', target='build', os='ubuntu']
    # ]
    # Build-deps for apt-python via git SCM: sudo apt install libapt-pkg-dev 
    python_requires='>=3.5',
    install_requires=[
        'python-apt (>= 2.0)',
        # graph-tools is for my project... ignore this
        'graph-tools (>= 1.5)'
    ],
    package_dir={'': 'lib'},
    scripts=_glob('bin/*'),

[...SNIP...]

)

Note: os_requires isn't actually supported yet, but is proposed. This might help in the future for external dependencies on packages. It would help in situations like this where a python module is not distributed via PyPi / pip, but instead is only provided via apt / .deb packages on the OS.

This results in the following when running pip3 install -r requirements.txt:

$ pip3 install -r requirements.txt
Looking in indexes: https://pypi.python.org/simple/
Obtaining file:///~/src/pub/apt-package-viz (from -r requirements.txt (line 4))
Obtaining python-apt from git+https://salsa.debian.org/apt-team/python-apt.git#egg=python-apt (from -r requirements.txt (line 3))
  Updating ./package-viz/src/python-apt clone
  Running command git fetch -q --tags
  Running command git reset --hard -q c97d4159beae2f9cd42d55d3dff9c37f5c69aa44
Requirement already satisfied: graph-tools>=1.5 in ./package-viz/lib/python3.8/site-packages (from apt-package-viz==0.0.1->-r requirements.txt (line 4)) (1.5)
Requirement already satisfied: numpy in ./package-viz/lib/python3.8/site-packages (from graph-tools>=1.5->apt-package-viz==0.0.1->-r requirements.txt (line 4)) (1.19.0)
Requirement already satisfied: perlcompat in ./package-viz/lib/python3.8/site-packages (from graph-tools>=1.5->apt-package-viz==0.0.1->-r requirements.txt (line 4)) (1.1)
Requirement already satisfied: pytess in ./package-viz/lib/python3.8/site-packages (from graph-tools>=1.5->apt-package-viz==0.0.1->-r requirements.txt (line 4)) (1.0.0)
ERROR: apt-package-viz 0.0.1 has requirement python-apt>=2.0, but you'll have python-apt 0.0.0 which is incompatible.
Installing collected packages: python-apt, apt-package-viz
  Running setup.py develop for python-apt
  Running setup.py develop for apt-package-viz
Successfully installed apt-package-viz python-apt

Note: You'll probably want to install runtime & build / setup.py dependencies for python-apt too:

# Runtime deps (e.g.: Ubuntu 20.04 needs python3-apt):
sudo apt install python3-apt apt
# python-apt pip install deps (also for setup.py / development)
sudo apt install libapt-pkg-dev

EDIT: I've found others running into this problem on SO here, and provided a more complete answer. The desired solution depends on which version of python-apt you want to use (e.g.: System base OS vs. GitLab latest / tagged release, etc... )

hududed commented 6 months ago

@trinitronx I know its been awhile but could you show the full requirements.txt e.g. if a specific version python-apt==2.4.0 is needed?