简体   繁体   中英

Python to .exe raises Exception: Versioning for this project requires either an sdist tarball

I'm trying to build an executable from Python files. I was able to correct most errors, but now I'm stuck with this one and I can't find out how to correct it. My program interacts with the Jira API.

I'm using Cx_Freeze to build the .exe with the following setup. py file :

import sys
import setuptools
from cx_Freeze import setup, Executable

build_exe_options = {"includes": ["appdirs", "packaging.specifiers", 
                     "packaging.requirements", "setuptools.msvc", "jira"]}

setup(name="Quick", version="1.0", executables=[Executable("main.py")], 
      options={"build_exe": build_exe_options},
      install_requires=['selenium', 'jira', 'cx_Freeze'])

I enter in command prompt: python setup.py build and get a folder named build as a result. It contains a main.exe program. When I launch it from command prompt I get this error :

Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name jira was given, but was not able to be found.

I've tried to upgrade Jira, setuptools and disutils with pip but it didn't change anything.

I'm using Python 3.6.

I have finally gotten this working and thought I should share my results since there seem to be very few people using Jira and cx_Freeze together. It seems that cx_Freeze does not package Jira properly. Below is what I did to get my script working.

First, in setup.py, I included these packages:

packages = ["os", "sys", "atexit", "getpass", "subprocess", "datetime", "dateutil", "jira", "openpyxl", "appdirs", "packaging"]

Many of these are not necessary for everyone but jira, appdirs, and packaging helped me.

Then, after running python setup.py build , I copied:

C:\Users\me\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\idna
C:\Users\me\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\idna-2.6.dist-info
C:\Users\me\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\jira
C:\Users\me\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\jira-1.0.15.dist-info

into:

build\\exe.win32-3.6\\lib (the directory created by running setup.py) overwriting any conflicts.

This solved the problem for me. Let me know if you have any other issues.

I've got this exception while importing jira in a PyDev project, which links the jira git clone as a Project Reference .

The workaround for me was to extend the PATH environment to include the git executable.

Analyse

pbr/packing.py - get_version() raise

Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. ...

when _get_version_from_git() returns None . This happens, when pbr/git.py - _run_git_functions() - _git_is_installed() does not find a git executable.

I was getting the same issue when I tried to upload my code with packages on AWS lambda function. After multiple trial and errors, adding the idna packages along with the jira packages worked for me.

idna
idna-2.10.dist-info
jira
jira-2.0.0.dist-info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM