标签: setuptools

DistutilsError:找不到 Requirement.parse('setuptools-scm') 的合适发行版

您好,当尝试将 django 应用程序部署到 elastic beanstalk 时,会出现此错误,

DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools-scm')
Run Code Online (Sandbox Code Playgroud)

我尝试在我的requirements.txt 文件甚至我的.ebextension 目录中添加库setuptools-scm,但仍然没有任何建议?

编辑,这是错误的完整日志:

Application deployment failed at 2021-05-18T23:56:56Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. Collecting Django==1.11.16 Using cached Django-1.11.16-py2.py3-none-any.whl (7.0 MB) Collecting django-oscar==1.6.4 Using cached django_oscar-1.6.4-py2.py3-none-any.whl (7.5 MB) Collecting psycopg2==2.7.3.2 Using cached psycopg2-2.7.3.2-cp36-cp36m-manylinux1_x86_64.whl (2.7 MB) Collecting openpyxl==2.4.10 Using cached openpyxl-2.4.10.tar.gz (158 kB) Collecting django-storages==1.6.5 Using cached django_storages-1.6.5-py2.py3-none-any.whl (47 kB) Collecting boto3==1.5.19 Using cached boto3-1.5.19-py2.py3-none-any.whl (128 kB) Collecting django-ipware==2.0.1 Using cached django-ipware-2.0.1.tar.gz (10 …

setuptools django-haystack python-3.x amazon-elastic-beanstalk

2
推荐指数
1
解决办法
1万
查看次数

使用 setuptools/distutils 构建 PyInstaller exe 时,ensure_local_distutils 内部出现断言错误

我正在尝试将一些 Python 代码转换为.exePyInstaller。我的代码使用 distutils,这在过去已经让我有些头疼,因为它似乎重复了 setuptools 的功能,并且与它的交互很奇怪。例如,它需要未使用的setuptools 导入才能正常工作,这对我来说似乎非常不Python。

我需要在我的项目中使用这两个包。我在订单中导入了两个包,import setuptools; import distutils因为另一个订单抛出了一个已经令人担忧的警告。

我的脚本运行良好,但在我将其转换为 exe 后,我在 setuptools 的可疑子模块内得到了回溯_distutils_hack是的,它只是打印一个没有上下文的文件名。

Traceback (most recent call last):
  <18 lines omitted>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "_distutils_hack\override.py", line 71, in <module>
  File "_distutils_hack\__init__.py", line 71, in do_override
  File "_distutils_hack\__init__.py", line 59, in ensure_local_distutils
AssertionError: C:\Users\<omitted>\AppData\Local\Temp\_MEI294562\distutils\core.pyc 
Run Code Online (Sandbox Code Playgroud)

我在用

  • Python 3.7.7 on win32(但我用 3.8、3.9 和 3.10 复制了它)
  • pyinstaller==4.8(2022 年 1 月)Windows 版
  • distutils==3.7.7(内置) …

python distutils setuptools pyinstaller

2
推荐指数
1
解决办法
4621
查看次数

使用生成的 Python 文件构建包

问题陈述

\n

构建 Python 包时,我希望构建工具自动执行步骤来生成必要的 Python 文件并将它们包含在包中。

\n

以下是有关该项目的一些详细信息:

\n
    \n
  • 项目存储库仅包含手写的Python和YAML文件
  • \n
  • 要获得功能齐全的包,必须将 YAML 文件编译为 Python 脚本
  • \n
  • 一旦从 YAML 生成 Python 文件,就不再需要编译它们所需的程序(构建依赖项)。
  • \n
  • 然后将手写的和生成的 Python 文件打包在一起。
  • \n
\n

然后该包将上传到 PyPI。

\n

我想实现以下目标:

\n
    \n
  • 当用户从 PyPI 安装包时,包运行所需的所有必需文件都包含在内,无需执行任何编译步骤
  • \n
  • 当用户签出存储库并使用 构建包时python -m build . --wheel,YAML 文件会自动编译为 Python 并包含在包中。需要编译器。
  • \n
  • 当用户签出存储库并从源安装包时,YAML 文件会自动编译为 Python 并安装。需要编译器。
  • \n
  • (很高兴有)当用户检出存储库并以可编辑模式安装时,YAML 文件将被编译为 Python。用户可以自由地修改生成的和手写的 Python 文件。需要编译器。
  • \n
\n

我有一个具有以下布局的存储库:

\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 <project>\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 <project>\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 hand_written.py\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 specs\n\xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 file.ksc (YAML file)\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 …
Run Code Online (Sandbox Code Playgroud)

setuptools setup.py python-packaging pyproject.toml

2
推荐指数
1
解决办法
768
查看次数

我可以使用没有/ usr/local等权限的setuptools

我想使用一些软件包(即IPython或zdaemon),但我在一个系统(我的大学)上这样做,它没有给我/ usr/local,/ usr/bin或所有这些目录的权限.有办法解决吗?

python setuptools

1
推荐指数
1
解决办法
2281
查看次数

创建从git仓库安装的Python .egg

我目前正在研究Python产品的部署技术。我们已经使用多个git存储库来管理代码,但希望改善设置和更新服务器的过程。如今,easy_install,.egg文件和virtualenv似乎是最好的工具。

要注意的是:我们实际上并没有进行版本控制。我们所有的产品都有一个master分支,该分支应该一直提供稳定的代码。如果要更新,则必须git pull针对每个产品及其所有依赖性在每个服务器上的master分支。

该解决方案非常耗时,我们希望对其进行改进。

我的想法是在所有服务器/安装上创建一个virtualenv实例,并使用easy_install来安装和更新我们自己的软件包,但是我找不到一种方法来指定git存储库作为源代码的源。

有办法实现吗?我错过了什么?我是朝错误的方向前进吗?总体而言,这是个坏主意吗?

在此先感谢Fabian

python setuptools virtualenv

1
推荐指数
1
解决办法
980
查看次数

无法让matplotlib使用代码进行简单的绘图

我尝试使用pip install matplotlib安装matplotlib,它重新调整了以下错误.作为参考,我使用的是Windows 7.

Removing temporary dir c:\users\user\appdata\local\temp\pip_build_RTRA...
Command C:\python27\python.exe -c "import setuptools;__file__='c:\\users\\user\\appdata\\local\\temp\\pip_build_USER\\matplotlib\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-yplfpm-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\user\appdata\local\temp\pip_build_USER\matplotlib

Exception information:
Traceback (most recent call last):
  File "C:\python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands\install.py", line 241, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "C:\python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 1298, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "C:\python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 625, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "C:\python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\util.py", line 670, in call_subprocess
    % (command_desc, …
Run Code Online (Sandbox Code Playgroud)

python pip matplotlib setuptools python-2.7

1
推荐指数
1
解决办法
2875
查看次数

模块作为Python中没有.py的脚本?

我想要一个包含名为'foobar'的代码的Python文件,该代码在安装软件包时作为脚本执行,如下所示:

$ foobar -i arg1 arg2
Run Code Online (Sandbox Code Playgroud)

foobar被声明为脚本setup.py.

foobar文件还包含由包中的其他模块导入的函数/类,因此有一个单独的文件quux.py导入foobar:

(in `quux.py`):
import mypackage
import mypackage.foobar as foobar
Run Code Online (Sandbox Code Playgroud)

如何在foobar没有.py扩展名的情况下保留并将其声明为脚本,setup.py但仍然可以将其作为模块从另一个文件中导入?这是正确的答案:导入没有.py扩展名的python模块, - 还是有另一种技巧?

python pip python-module setuptools

1
推荐指数
1
解决办法
94
查看次数

使用Python setuptools.command.sdist导入错误

我正在尝试安装Newspaper,它使用pip安装了一大堆依赖项.在安装许多依赖项的过程中,会出现此错误:

ImportError: <module 'setuptools.command.sdist' from '/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.pyc'> has no '_default_revctrl' attribute
Run Code Online (Sandbox Code Playgroud)

没有pip的安装工作正常,但由于报纸的依赖数量很多,所以非常繁琐.任何人都可以帮我一把吗?

这是一个错误实例的完整回溯:

Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/Pillow.egg-info
    writing pip-egg-info/Pillow.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
    writing pip-egg-info/Pillow.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/Pillow.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-auItlo/Pillow/setup.py", line 757, in <module>
        zip_safe=True,
      File "/usr/lib/python2.6/distutils/core.py", line 152, …
Run Code Online (Sandbox Code Playgroud)

python pip setuptools importerror

1
推荐指数
1
解决办法
2118
查看次数

python setup.py sdist和自定义设置关键字不能一起播放

副标题:不仅是sdist

我正在尝试获取我正在努力setup.py的包的文件sdist.该setup.py文件的相关部分是:

from setuptools.command.test import test
[...]
class Tox(test):
   "as described in 
    http://tox.readthedocs.org/en/latest/example/basic.html?highlight=setuptools#integration-with-setuptools-distribute-test-commands"
   [...]
def run_tests(self):
    if self.distribution.install_requires:
        self.distribution.fetch_build_eggs(
            self.distribution.install_requires)
    if self.distribution.tox_requires:
        self.distribution.fetch_build_eggs(self.distribution.tox_requires)
    # import here, cause outside the eggs aren't loaded
    import tox
    import shlex
    args = self.tox_args
    if args:
        args = shlex.split(self.tox_args)
    else:
        args = ""
    errno = tox.cmdline(args=args)
    sys.exit(errno)


entry_points ={}
distutils_ext = {'distutils.setup_keywords': [
                    "tox_requires = setuptools.dist:check_requirements", ]
                 }
entry_points.update(distutils_ext)

setup(
      install_requires=['six', 'numpy', 'matplotlib', 'scipy', 'astropy>=1',
                  'Pillow', ],

    cmdclass={
        'test': …
Run Code Online (Sandbox Code Playgroud)

python setuptools

1
推荐指数
1
解决办法
1576
查看次数

创建了 PyPi 包,但安装后无法导入模块

我有一个这样结构的项目:

.
??? LICENSE
??? README.md
??? setup.py
??? src
    ??? __init__.py (with name="packagename")
    ??? module1
    ?   ??? __init__.py (with import for each code file)
    ?   ??? (several code files)
    ??? module2
        ??? __init__.py
        ??? (similar structure to module1, total of 4 modules like this)
Run Code Online (Sandbox Code Playgroud)

我已经创建了 dist 文件并将它们上传到 TestPyPI 并安装到测试项目中。我希望能够导入诸如 的模块import packagename.module1,但它给了我No module named packagename.

我的setuptools.setup参数中setup.py包含这样的条目:

packages=["packagename"],
package_dir={"packagename": "src"},
py_modules=["packagename.module1", "packagename.module2" ... ]
Run Code Online (Sandbox Code Playgroud)

知道为什么我在安装软件包后似乎无法导入吗?

我在项目中的 src 之外有各种示例测试脚本,我可以在其中访问模块from src.module1 import ClassName(尽管如果可能 …

python setuptools pypi

1
推荐指数
1
解决办法
1256
查看次数