Hello fellow programmers,
So lately I've been working on a project at my work that we want to open source. It's the package called django-push-notifications-manager (yes, what a unusual long name I know).
So I already did the registration and the uploading of the package, but for some kind of reason pip install django-push-notifications-manager will not work and will give the error:
Downloading/unpacking django-push-notifications-manager
Could not find any downloads that satisfy the requirement django-push-notifications-manager
Cleaning up...
No distributions at all found for django-push-notifications-manager
Storing debug log for failure in /Users/pauloostenrijk/.pip/pip.log
So I haven't been able to fix it by removing and replacing the package, deleting it, making a new version. None of them worked.
I think you guys would like to know what my setup.py was, so hereby:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import push_notifications
def get_packages(package):
"""
Return root package and all sub-packages.
"""
return [dirpath
for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, '__init__.py'))]
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = push_notifications.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You probably want to also tag the version now:")
print(" git tag -a %s -m 'version %s'" % (version, version))
print(" git push --tags")
sys.exit()
readme = open('README.rst').read()
setup(
name='django-push-notifications-manager',
version=version,
description="""A plug and play package to handle push devices and push notifications for services such as ZeroPush and Urban Airship""",
long_description=readme,
author='Paul Oostenrijk',
author_email='paul#glemma.nl',
url='https://github.com/glemmaPaul/django-push-notifications-manager',
packages=get_packages('push_notifications'),
include_package_data=True,
install_requires=[
'django>=1.5.1',
'requests>=2.5.1'
],
license="BSD",
zip_safe=False,
keywords='django-push-notifications-manager',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
],
)
Hope any of you guys could help me out! Thanks in advance :)
So after spending a long time of trying and figuring out I finally found the problem.
Don't look strange to me, but apparently PyPi has problems with the name django-push-notifications-manager, I think there can be 2 causes:
The length of the name
That having 2 dashes in the name is the maximum
I hope nobody will ever get this problem, it was head cracking!
Thanks for your time!
Related
I'd like to ask a question about how to configure setup.py with Cython, setuptools extensions etc. I'm trying cythonize a submodule with Cython.Distutils's build_ext. But the issue isn't Cython.Distutils's Extentsion module, (if it exists) because it isn't loaded. Only build_ext. So I create a setuptools.extension Extension in a list, and then cythonize the list of Extension objects. There's only one Extension in the list, an its as follows.
Extension("distance", ["kmerdb/distance.pyx"], include_dirs=[np.get_include()])
I've tried different methods of installation, from python setup.py install to pip install -e . to generating the wheel file and installing the wheel. I couldn't find anything that worked...
Okay, so I know very little about the process and that's probably why I am getting hung up but I've searched the whole site, no luck. So here goes.
I'm running the following shell script to install my package locally, and it works fine. The problem is the installation doesn't move the .so and the .py file into the kmerdb module I'm trying to export. Any suggestions? Thanks
>python setup.py sdist bdist_wheel
>/bin/auditwheel repair --plat manylinux2014_x86_64 dist/kmerdb-*linux_x86_64.whl
>mv wheelhouse/* dist
>rm dist/*linux_x86_64.whl
>pip install dist/kmerdb-*-manylinux2014_x86_64.whl
>ls ~/.pyenv/versions/kdb/lib/python3.10/site-packages/kmerdb-0.6.5-py3.10-linux-x86_64.egg/
distance.cpython-310-x86_64-linux-gnu.so distance.py kmerdb ...
Again, the files distance.cpython-310-x86_64-linux-gno.so is not moved into the kmerdb module, my Python packages, which I'm trying to install locally and configure for .whl upload to PyPI.
Python 3.10.1 (main, Jan 1 2022, 21:28:19) [GCC 11.1.0] on linux
Cython==0.29.26
setup.py
Extension("distance", ["kmerdb/distance.pyx"], include_dirs=[np.get_include()], define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],),
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
download_url=CURRENT_RELEASE,
keywords = ["k-mer", "kmer", "k-merdb", "kmerdb", "kdb"],
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
package_dir={'kmerdb': 'kmerdb'},
package_data={'kmerdb': ['CITATION']},
# If your package is a single module, use this instead of 'packages':
#py_modules=['kmerdb'],
#scripts=['bin/kmerdb', 'bin/kmerdb_report.R'],
entry_points={
'console_scripts': ['kmerdb=kmerdb:cli'],
},
install_requires=REQUIRED,#['Cython==0.29.21', 'numpy==1.18.1'],
extras_require=EXTRAS,
include_package_data=True,
license='GPLv3+',
test_suite='test',
# tests_require=['mamba', 'expect'],
ext_modules=cythonize(extensions),
library_dirs=["."],
zip_safe=False,
)
I'm going to self answer here. The issue stemmed from an improperly specified Extension.
Extension("kmerdb.distance", ["kmerdb/distance.pyx"], include_dirs=[np.get_include()])
All I had to do was include the module name for the fully specified submodule hierarchy. Fixed it!
I am trying to install subprocess32 with my python 2.7 installation via buildroot. It appeared to install correctly but when I import it on the embedded system I get an error:
>>> import subprocess32
/usr/lib/python2.7/site-packages/subprocess32.py:472: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your pro
gram uses threads.
"program uses threads.", RuntimeWarning)
Following this path I tried to import _posixsubprocess
import _posixsubprocess
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (init_posixsubprocess)
subprocess32 seems to have it's own version and it's not working in this case?
Here is my make file:
#############################################################
#
# Subprocess32 module for python
#
#############################################################
SUBPROCESS32_VERSION = 3.2.7
SUBPROCESS32_SOURCE = subprocess32-$(SUBPROCESS32_VERSION).tar.gz
SUBPROCESS32_SITE = https://pypi.python.org/pypi/subprocess32
SUBPROCESS32_DEPENDENCIES = python
define SUBPROCESS32_BUILD_CMDS
(cd $(#D); $(HOST_DIR)/usr/bin/python setup.py build)
endef
define SUBPROCESS32_INSTALL_TARGET_CMDS
(cd $(#D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(call GENTARGETS,package,subprocess32))
There is a similar post about this Python Error The _posixsubprocess module is not being used However the answer is a link in the comments which is dead. Any ideas for my problem?
setup.py:
#!/usr/bin/python
import os
import sys
from distutils.core import setup, Extension
def main():
if sys.version_info[0] != 2:
sys.stderr.write('This backport is for Python 2.x only.\n')
sys.exit(1)
ext = Extension('_posixsubprocess', ['_posixsubprocess.c'],
depends=['_posixsubprocess_helpers.c'])
if os.name == 'posix':
ext_modules = [ext]
else:
ext_modules = []
setup(
name='subprocess32',
version='3.2.7',
description='A backport of the subprocess module from Python 3.2/3.3 for use on 2.x.',
long_description="""
This is a backport of the subprocess standard library module from
Python 3.2 & 3.3 for use on Python 2.
It includes bugfixes and some new features. On POSIX systems it is
guaranteed to be reliable when used in threaded applications.
It includes timeout support from Python 3.3 but otherwise matches
3.2's API. It has not been tested on Windows.""",
license='PSF license',
maintainer='Gregory P. Smith',
maintainer_email='greg#krypto.org',
url='https://github.com/google/python-subprocess32',
ext_modules=ext_modules,
py_modules=['subprocess32'],
classifiers=[
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: POSIX',
'Operating System :: POSIX :: BSD',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: SunOS/Solaris',
'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
],
)
if __name__ == '__main__':
main()
I'm not sure which Buildroot version you're using, but if it's still a version that uses the GENTARGETS macro and that doesn't have the python-package infrastructure, then it must be a really, really, really old version. Please upgrade first, as many, many fixes have been made in recent years in the Python support.
The issue was that distutils was using the wrong compiler for building shared objects (other objects used the right compiler). Setting the below LDSHARED variable during the build phase solved the issue:
LDSHARED="$(TARGET_CC) -pthread -shared"
I created a package, named furigana . This package page can be browsed by a user not logined to pypi. However, if I type "furigana" in the homepage of pypi, it can not find my package "furigana".
I also used pip3 search to search it, and it also find nothing.
I ran below commands to create archive and upload it by twine:
python3 setup.py test
python3 setup.py sdist
twine upload dist/furigana-0.0.7.tar.gz
The output message of twine is:
Uploading distributions to https://upload.pypi.org/legacy/
Uploading furigana-0.0.7.tar.gz
My ~/.pypirc is
[distutils]
index-servers =
pypi
[pypi]
repository: https://upload.pypi.org/legacy/
username:<my_username>
password:<my_password>
My setup.py is
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(name='furigana',
version='0.0.7',
description='''convert Kanji in Japanese into Kanji attached with Hiragana (Furigana(振り仮名))
For example, "澱んだ街角" => "澱(よど)んだ街角(まちかど)" ''',
long_description = long_description,
author='Miki.Liu',
author_email='mikimotoh#gmail.com',
url='https://github.com/MikimotoH/furigana',
packages=['furigana'],
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: Linguistic',
],
keywords='Japanese Language Processing',
)
Cannot search package in PyPI with pip doesn't resolve my problem, the bitbucket repository is already removed.
I am trying to install a python package on my ubuntu.I am trying to install it through a setup script which i had written.The setup.py script looks like this:
from setuptools import setup
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name = 'pyduino',
description = 'PyDuino project aims to make python interactive with hardware particularly arduino.',
url = '###',
keywords = 'python arduino',
author = '###',
author_email = '###',
version = '0.0.0',
license = 'GNU',
packages = ['pyduino'],
install_requires = ['pyserial'],
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
scripts=['pyduino/pyduino.py'],
)
Package installs in /usr/local/bin directory.But when I am importing the modules outside the /usr/local/bin,import error occurs.I tried changing path to /usr/local/bin and it works perfectly and import error doesn't occur.How can I install the package so that I can import the modules in any directory? Thanks in advance...
Try install your packages with pip using this
pip install --install-option="--prefix=$PREFIX_PATH" package_name
as described here Install a Python package into a different directory using pip?
and i'll suggest to read what are 1. pip 2. virtualenv
Good luck :)
EDIT: i found the package is installed with pip like:
pip install --install-option="--prefix=/usr/local/bin" pyduino_mk
Currently, you're using a scripts tag to install your python code. This will put your code in /usr/local/bin, which is not in PYTHONPATH.
According to the documentation, you use scripts when you want to install executable scripts (stuff you want to call from command line). Otherwise, you need to use packages.
My approach would be like this:
install the pyduino/pyduino.py in the library with something like packages=['pyduino']
create a wrapper (shell or python) capable of calling your installed script and install that via scripts=[...]
Using the packages tag for your module will install it in /usr/local/lib/python..., which is in PYTHONPATH. This will allow you to import your script with something like import pyduino.pyduino.*.
For the wrapper script part:
A best practice is to isolate the code to be executed if the script is triggered from command line in something like:
def main():
# insert your code here
pass
if __name__ == '__main__':
main()
Assuming there is a def main() as above
create a directory scripts in your tree (at the same level with setup.py)
create a file scripts/pyduino
in scripts/pyduino:
#!/usr/bin/env python
from pydiuno.pyduino import main
if __name__ == '__main__':
main()
add a `scripts = ['scripts/pyduino'] to your setup.py code
I'm new to python and writing an application which I want to package for debian. Therefore, I'd like to (and I have to) use pybuilder. My goal is to create a .deb package (currently using stdeb), which makes sure, that all required libraries are installed, too.
My application uses a third party library, that is only available via pip(3) install (no debian package).
My build.py looks like:
[...]
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.distutils")
use_plugin("copy_resources")
use_plugin("source_distribution")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.stdeb")
#init
def initialize(project):
project.build_depends_on('coverage')
project.build_depends_on('flake8')
project.build_depends_on('jsonmerge')
project.build_depends_on('mock')
project.build_depends_on('setuptools')
project.build_depends_on('stdeb')
project.build_depends_on('unittest-xml-reporting')
project.build_depends_on('xmlrunner')
project.depends_on('<pip-only-library>')
project.set_property('coverage_threshold_warn', 50)
project.set_property('flake8_break_build', False)
project.set_property('flake8_ignore', 'E501,E402,E731')
project.set_property('flake8_include_test_sources', True)
project.set_property('flake8_verbose_output', True)
project.set_property('verbose', True)
project.set_property("copy_resources_target", "$dir_dist")
project.set_property("coverage_break_build", False)
project.set_property("coverage_reset_modules", True)
project.set_property("dir_dist_scripts", 'scripts')
project.set_property("distutils_classifiers", [
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Development Status :: 4',
'Environment :: Console',
'Intended Audience :: Systems Administration',
'License :: OSI Approved :: BSD License'])
project.set_property('distutils_commands', ['bdist'])
project.set_property('distutils_commands', ['sdist'])
Generation of debian package works in general. Calling pyb successfully creates a python3-mypackage_1.0-1_all.deb package.
The generated setup.py looks like:
# `target/dist/mypackage-1.0/setup.py`
[...]
if __name__ == '__main__':
setup(
[...]
packages = [],
[...]
entry_points = {},
data_files = [],
package_data = {},
install_requires = ['pip-only-library'],
dependency_links = [],
zip_safe=True,
cmdclass={'install': install},
)
Testing package installation using sudo dpkg -i python3-mypackage_1.0-1_all.deb fails as dpkg refers to a dependent package python3-<pip-only-library>, which is not available.
During build time, the library is present on the local machine.
So, now comes the newbie question: How to change build.py to make sure, that the created debian package provides my application and makes sure, that library requirements are met.
Maybe, is it possible to bundle the pip-only library (i.e. taken from /usr/local/lib/python3.4/dist-packages during build-time) to my application and ship them within an 'application with all dependencies'-package? Or is there an alternative approach?
I've already seen this answer but it doesn't help.