Project

General

Profile

SOLVED: error retrieving version during setup.py build on Windows installation

Added by Anchi Cheng about 7 years ago

From Patric Goetz

I ran into a problem installing leginon on the microscope PC. The other stuff installed fine.

Z:\myami-beta\leginon>C:\\python27-win32\python.exe setup.py install
Traceback (most recent call last):
File "setup.py", line 15, in <module>
version=str(version.getVersion()),
File "Z:\myami-beta\leginon\version.py", line 90, in getVersion
return gitlib.getCurrentCommitCount()
File "C:\python27-win32\lib\site-packages\pyami\gitlib.py", line 17, in getCur
rentCommitCount
return getCurrentCommitCountOLDGit()
File "C:\python27-win32\lib\site-packages\pyami\gitlib.py", line 25, in getCur
rentCommitCountOLDGit
number = int(result)
ValueError: invalid literal for int() with base 10: ''

Z:\myami-beta\leginon>


Replies (12)

RE: error retrieving version during setup.py build on Windows installation - Added by Anchi Cheng about 7 years ago

gitlib.py should detect the platform being win32 and give back a dummy version instead of trying to get a commit count.

This test in python IDLE command window should reproduce your error

from pyami import gitlib
gitlib.getCurrentCommitCount()

Please check within python command what it thinks its platform is

import sys
sys.platform

RE: error retrieving version during setup.py build on Windows installation - Added by Sargis Dallakyan about 7 years ago

Tested this on a Windows laptop and it works for me:

C:\Users\sargis\git\myami\leginon>c:\Python27\python.exe
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyami import gitlib
>>> gitlib.getCurrentCommitCount()
100000
>>> import sys
>>> sys.platform
'win32'

Is Patric Goetz using trunk or some other branch?

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

Patrick Goetz is running beta (except for myamiweb, which is sort of a branch of trunk). Will check on the IDLE output in a bit. The microscope and PC microscope are in another building.

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

Hi -

I ran the commands Anchi suggested on the microscope pc. Here is a transcript of the output

C:\>cd Python27-win32

C:\Python27-win32>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyami import gitlib
>>> gitlib.getCurrentCommitCount()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27-win32\lib\site-packages\pyami\gitlib.py", line 17, in getCur
rentCommitCount
    return getCurrentCommitCountOLDGit()
  File "C:\Python27-win32\lib\site-packages\pyami\gitlib.py", line 25, in getCur
rentCommitCountOLDGit
    number = int(result)
ValueError: invalid literal for int() with base 10: ''
>>>

>>> import sys
>>> sys.platform
'win32'
>>>

RE: error retrieving version during setup.py build on Windows installation - Added by Sargis Dallakyan about 7 years ago

Hi,

This might be a different version of gitlib.py since line numbers don't match what we have at http://emg.nysbc.org/projects/appion/repository/revisions/myami-beta/entry/pyami/gitlib.py. You can download that file and replace your copy of C:\Python27-win32\lib\site-packages\pyami\gitlib.py to see if that works.

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

According to git, my copy of myami-beta is up to date, and this is what I copied over to the Microscope Windows PC:

cnsit@kraken:~/leginon$ cd myami-beta/
cnsit@kraken:~/leginon/myami-beta$ git status
On branch myami-beta
Your branch is up-to-date with 'origin/myami-beta'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    imageviewer/build/
    leginon/build/
    modules/libcv/build/
    modules/numextension/build/
    modules/radermacher/build/
    pyami/build/
    pyscope/build/
    pysetup.log
    redux/build/
    sinedon/build/

nothing added to commit but untracked files present (use "git add" to track)

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

However, you are correct: the two versions are different. What's going on here?

cnsit@kraken:~/leginon/myami-beta/pyami$ pwd
/home/cnsit/leginon/myami-beta/pyami
cnsit@kraken:~/leginon/myami-beta/pyami$ diff gitlib.py ../../gitlib.py 
2c2
< 
---
> import sys
9a10,12
>     if sys.platform == 'win32':
>         # fake return.  No easy way to get git version
>         return 100000
47c50
<         print "Warning: git version is possibly too old. Trying getAvailableTagsForBranchOLDGit()" 
---
>         print "Warning: git version is possibly too old for tag option --merged. Trying getAvailableTagsForBranchOLDGit()" 
cnsit@kraken:~/leginon/myami-beta/pyami$

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

Also, I notice that this python script is a "library for working with git".

Does this mean I need to install git on the Windows PC? There's no mention of this in the Wiki documentation.

RE: error retrieving version during setup.py build on Windows installation - Added by Anchi Cheng about 7 years ago

If you copied the files from your linux box, you don't need to install git. You just have to make sure what you have on linux pc is up to date.

On linux box, git tells you that you are up-to-date with the lat pull or clone you did with origin/myami-beta. It does not mean that you are up-to-date to the remote repository. To get an updated git, you need to use git command:

cd myami-beta
git pull

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

Thanks for that clarification, Anchi. I'm still new to git and learning the ropes. OK, will update the myami-beta repo, and from the diff it looks like this fix specifically addresses the issue I'm having. Will know later today.

RE: error retrieving version during setup.py build on Windows installation - Added by Patrick Goetz about 7 years ago

Thanks Sargis, that hint resolved my issue. I updated my clone of myami-beta, copied the new software over the the microscope PC, and now everything installs properly. Marking this issue as solved.

RE: SOLVED: error retrieving version during setup.py build on Windows installation - Added by Sargis Dallakyan about 7 years ago

You are welcome Patrick. Glad this is solved now.

    (1-12/12)