You are not logged in.

#1 2019-03-12 20:54:42

andalenavals
Member
Registered: 2017-10-30
Posts: 39

[SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

Hello everyone,
I am not sure why I am getting a compiled package from a different version than the one a select in the source.
This is the PKGBUILD I am talking about

# Maintainer: Andres Alejandro Navarro Alsina <aanavarroa@unal.edu.co>
# Contributor: Dan Foreman-Mackey
_pkgname=python-emcee-git 
pkgbase=python-emcee-git
pkgname=("python-emcee-git" "python2-emcee-git")
pkgver=v1.2.0.r193.g67c8f79
pkgrel=1
pkgdesc=" The Python ensemble sampling toolkit for affine-invariant MCMC  "
arch=('any')
url="https://github.com/dfm/emcee.git"
license=('MIT')
makedepends=('git' 'python' 'python-numpy' 'python2' 'python2-numpy')
checkdepends=('python-nose' 'python2-nose' 'python-pytest' 'python-scipy' 'python2-scipy' 'python-h5py' 'python2-h5py')
optdepends=('python2-pytest')
source=("${_pkgname}::git+${url}#tag=v3.0rc2")
md5sums=('SKIP')

pkgver() {
	 cd "$srcdir"/$_pkgname
	 printf "%s" "$(git describe --long | sed 's/^foo-//;s/\([^-]*-g\)/r\1/;s/-/./g')"
	
}

prepare() {
	  cp -a $_pkgname{,-py2}
}

build() {
	cd "$srcdir"/$_pkgname
	python setup.py build

	cd "$srcdir"/$_pkgname-py2
	python2 setup.py build
}

check() {
	#python -c 'import emcee; emcee.test()'
	cd "$srcdir"/$pkgbase/emcee
	nosetests -v || warning 'Tests failed'

	cd "$srcdir"/$pkgbase-py2/emcee
	nosetests2 -v || warning 'Tests2 failed'
}

package_python-emcee-git() {
		       depends=()
		       cd "${_pkgname}"
		       python setup.py install --root=${pkgdir} --prefix=/usr --optimize=1
		       install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE
}

package_python2-emcee-git() {
			depends=()			    
			cd "${_pkgname}"
			python2 setup.py install --root=${pkgdir} --prefix=/usr --optimize=1
			install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE

}

The problem is that pkgver() is pointing to v1.20 and not to v3.0rc2. Not sure if this is an issue of my pkgver() function or the way how the repo itself was constructed.
EDIT:
I just realize that the attribute test() is not available for v3.0. But it is for an installation via pip of the version 2.2.1.
So now, I am thinking that there is something in my installation that might be wrong. When I installed emcee 2.2.1 via pip I checked that it was properly installed doing

python -c 'import emcee; emcee.test()'

, but now using my PKGBUILD and v3.0 I got

>>> import emcee
>>> emcee.test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'emcee' has no attribute 'test'
>>> emcee.__version__
'3.0rc2'

In fact, there is another point here, when I build the check() function I decide to use python-nose since importing emcee in the spawn python seems not possible. Am I right? or there was a way to include

python -c 'import emcee; emcee.test()'

in the check().
Thanks in advance,
Cheers.

Last edited by andalenavals (2019-03-13 17:59:15)

Offline

#2 2019-03-12 21:02:39

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

VCS_package_guidelines
v1.2.0 is the most recent annotated tag reachable from the un-annotated tag v3.0rc2

Offline

#3 2019-03-12 21:04:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,463

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

Without looking at the repo, does adding --tags to the git describe command change anything? Without that, it will only use annotated tags.

Online

#4 2019-03-12 21:43:11

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

Scimmia wrote:

Without looking at the repo, does adding --tags to the git describe command change anything? Without that, it will only use annotated tags.

Fully agree, the point is that probably the author forgot to set v3.0 as the newest annotated tag. Because here https://emcee.readthedocs.io/en/stable/ … om-source} and even here https://pypi.org/project/emcee/ people is working with newer versions.

Thanks @loqs I missunderstood that source when I read the first time. Problem solved.

Offline

#5 2019-03-12 22:20:30

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

Probably I should open another thread. But I just realize that the function I was thinking would be avaliable for v3.0 and was not for v1.2, in fact, is still missing.
So now, I am thinking that there is something in my installation that might be wrong. When I installed emcee 2.2.1 via pip I checked that it was properly installed doing

python -c 'import emcee; emcee.test()'

, but now using my PKGBUILD and v3.0 I got

>>> import emcee
>>> emcee.test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'emcee' has no attribute 'test'
>>> emcee.__version__
'3.0rc2'

In fact, there is another point here, when I build the check() function I decide to use python-nose since importing emcee in the spawn python seems not possible. Am I right? or there was a way to include

python -c 'import emcee; emcee.test()'

in the check().
Thanks in advance,
Cheers.

Offline

#6 2019-03-13 00:40:25

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

Offline

#7 2019-03-13 01:12:17

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

My point here is, why when I change the PKGBUILD to

source=("${_pkgname}::git+${url}#tag=v2.2.1")
md5sums=('SKIP')

pkgver() {
	 cd "$srcdir"/$_pkgname
	 printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')"
}	

I do not get the same installation in comparison with pip installation in pythonenv. When I run the test inside the module. i.e

>>> import emcee
>>> emcee.test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'emcee' has no attribute 'test'
>>> emcee.__version__
'3.0rc2'

while in the pythonenv

>>> import emcee    
>>> emcee.test()
Starting tests...
test_blobs ...
    Passed.
test_ensemble ...
    Passed.
test_inf_nan_params ...
    Passed.
test_mh ...
    Passed.
test_nan_lnprob ...
    Passed.
test_parallel ...
    Passed.
test_pt_sampler ...
[[15.65046778 18.47859427 11.36123513 11.71329902 23.88203279]
 [ 6.71938334  7.10780599  7.7866066   6.20599767  7.58489652]
 [ 2.94318588  2.87531101  2.63100026  1.95994463  2.39850766]
 [ 2.0142105   1.11460967  2.62266902  1.49140186  1.00963912]
 [ 1.57172626  1.22636691  2.3453819   1.5401352   1.07666669]
 [ 1.88175523  1.28833036  2.74477029  1.80719179  1.19561902]
 [ 1.814613    1.28004786  2.84098354  1.8367945   1.159872  ]
 [ 1.83719081  1.32076466  2.93318009  1.8394977   1.23466489]
 [ 1.86234389  1.25361237  3.02390132  1.91667631  1.16170745]
 [ 1.78678752  1.25756181  2.93250144  1.95421879  1.1758822 ]
 [ 1.77496619  1.31832157  2.83771074  1.90129316  1.22637821]
 [ 1.84035956  1.29265     2.83054788  1.9436424   1.20630287]
 [ 1.90943893  1.2044016   2.80968476  1.8928788   1.14965141]
 [ 1.92564617  1.14534166  2.95375369  1.77040936  1.13015629]
 [ 1.862436    1.17197352  2.79410313  1.76211984  1.16381337]
 [ 1.71318805  1.06894922  2.68543063  1.69736944  1.1177239 ]
 [ 1.76072647  1.05626317  2.78628925  1.66452576  1.11975029]
 [ 1.7080368   1.02461033  2.83184616  1.68012536  1.10091728]
 [ 1.65188942  1.00193732  2.83165797  1.69326625  1.09709593]
 [ 1.63997561  1.10715671  2.85709305  1.69971672  1.21464751]]
    Passed.
test_run_mcmc_resume ...
    Passed.
0 tests failed

Last edited by andalenavals (2019-03-13 01:14:13)

Offline

#8 2019-03-13 01:56:36

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

You can not use the python module from build in the check function as it has not been installed.  You are using the module emcee of the host system.
If you had built this in a clean chroot it would have failed due to the absence of python-setuptools and python2-setuptools if they had been present then the result would be

ModuleNotFoundError: No module named 'emcee'

Offline

#9 2019-03-13 10:51:04

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

loqs wrote:

You can not use the python module from build in the check function as it has not been installed.  You are using the module emcee of the host system.
If you had built this in a clean chroot it would have failed due to the absence of python-setuptools and python2-setuptools if they had been present then the result would be

ModuleNotFoundError: No module named 'emcee'

Yeap I got that part thats why I am only running the emcee.test() attribute after the installation(without worries about check() ). In fact, my pip installation is in another machine with another operating system. I am not sure how are you so sure that the build would have failed without python-setuptools. I just added, and  the building seems to report the same messages.
By the way, I was not able to put python-pytest as a makedepends because this error appears

error: failed retrieving file 'python2-scandir-1.9.0-1-x86_64.pkg.tar.xz' from www.caco.ic.unicamp.br : The requested URL returned error: 404
warning: failed to retrieve some files
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Build failed, check /home/andres/chroot/andres/build

how can I told to my chrood to look at [Community] repository. Shall I write a pacman.con and then

$ mkarchroot -C <pacman.conf> -c -r $CHROOT

Offline

#10 2019-03-13 11:59:17

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

There is no emcee.test() in v3.02rc2 https://github.com/dfm/emcee/commit/1da … cb0e3ce52a
I was running makepkg with --nocheck so checkdepends were not installed so python-nose / python2-nose did not pull in python-setuptools / python2-setuptools.
The commit I previously linked showed was to show you the tests were no longer in the emcee directory but the tests subdirectory if you wanted to keep using nose you would need to use that directory.
The produced packages currently have no depends.

Offline

#11 2019-03-13 13:02:53

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

andalenavals wrote:

My point here is, why when I change the PKGBUILD to

source=("${_pkgname}::git+${url}#tag=v2.2.1")
md5sums=('SKIP')

pkgver() {
	 cd "$srcdir"/$_pkgname
	 printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')"
}	

I do not get the same installation in comparison with pip installation in pythonenv. When I run the test inside the module. i.e

>>> import emcee
>>> emcee.test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'emcee' has no attribute 'test'
>>> emcee.__version__
'3.0rc2'

while in the pythonenv

>>> import emcee    
>>> emcee.test()
Starting tests...
test_blobs ...
    Passed.
test_ensemble ...
    Passed.
test_inf_nan_params ...
    Passed.
test_mh ...
    Passed.
test_nan_lnprob ...
    Passed.
test_parallel ...
    Passed.
test_pt_sampler ...
[[15.65046778 18.47859427 11.36123513 11.71329902 23.88203279]
 [ 6.71938334  7.10780599  7.7866066   6.20599767  7.58489652]
 [ 2.94318588  2.87531101  2.63100026  1.95994463  2.39850766]
 [ 2.0142105   1.11460967  2.62266902  1.49140186  1.00963912]
 [ 1.57172626  1.22636691  2.3453819   1.5401352   1.07666669]
 [ 1.88175523  1.28833036  2.74477029  1.80719179  1.19561902]
 [ 1.814613    1.28004786  2.84098354  1.8367945   1.159872  ]
 [ 1.83719081  1.32076466  2.93318009  1.8394977   1.23466489]
 [ 1.86234389  1.25361237  3.02390132  1.91667631  1.16170745]
 [ 1.78678752  1.25756181  2.93250144  1.95421879  1.1758822 ]
 [ 1.77496619  1.31832157  2.83771074  1.90129316  1.22637821]
 [ 1.84035956  1.29265     2.83054788  1.9436424   1.20630287]
 [ 1.90943893  1.2044016   2.80968476  1.8928788   1.14965141]
 [ 1.92564617  1.14534166  2.95375369  1.77040936  1.13015629]
 [ 1.862436    1.17197352  2.79410313  1.76211984  1.16381337]
 [ 1.71318805  1.06894922  2.68543063  1.69736944  1.1177239 ]
 [ 1.76072647  1.05626317  2.78628925  1.66452576  1.11975029]
 [ 1.7080368   1.02461033  2.83184616  1.68012536  1.10091728]
 [ 1.65188942  1.00193732  2.83165797  1.69326625  1.09709593]
 [ 1.63997561  1.10715671  2.85709305  1.69971672  1.21464751]]
    Passed.
test_run_mcmc_resume ...
    Passed.
0 tests failed

But neither in 2.2.1 ? look that I also changed the tag.
I just want to be able to run python -c 'import emcee; emcee.test()' after the installation.
Thats something I was able to do with the pip installation. But not with the package I build with that PKGBUILD.

Last edited by andalenavals (2019-03-13 13:08:19)

Offline

#12 2019-03-13 14:48:44

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

pkgname=("test-emcee")
pkgver=1
pkgrel=1
arch=('any')
depends=('python-emcee-git')

package() {
	python -c 'import emcee; print(emcee.__version__)'
	python -c 'import emcee; emcee.test()'
}

Works here with  python-emcee-git-v2.2.1.r0.g67c8f79-1-any.pkg.tar.xz provided python-emcee-git has a dependency on python-numpy.

extra-x86_64-build -- -I ../test/python-emcee-git-v2.2.1.r0.g67c8f79-1-any.pkg.tar.xz
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
:: Starting full system upgrade...
 there is nothing to do
==> Building in chroot for [extra] (x86_64)...
==> Synchronizing chroot copy [/var/lib/archbuild/extra-x86_64/root] -> [testuser]...done
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (7) blas-3.8.0-2  cblas-3.8.0-2  lapack-3.8.0-2  libnsl-1.2.0-1
             python-3.7.2-3  python-numpy-1.16.2-1
             python-emcee-git-v2.2.1.r0.g67c8f79-1

Total Installed Size:  171.45 MiB

:: Proceed with installation? [Y/n] 
(7/7) checking keys in keyring                     [######################] 100%
(6/7) checking package integrity                   [######################] 100%
(6/7) loading package files                        [######################] 100%
(7/7) checking for file conflicts                  [######################] 100%
:: Processing package changes...
(1/7) installing blas                              [######################] 100%
(2/7) installing cblas                             [######################] 100%
(3/7) installing lapack                            [######################] 100%
(4/7) installing libnsl                            [######################] 100%
(5/7) installing python                            [######################] 100%
Optional dependencies for python
    python-setuptools
    python-pip
    sqlite [installed]
    mpdecimal: for decimal
    xz: for lzma [installed]
    tk: for tkinter
(6/7) installing python-numpy                      [######################] 100%
Optional dependencies for python-numpy
    python-nose: testsuite
    openblas: faster linear algebra
(7/7) installing python-emcee-git                  [######################] 100%
Optional dependencies for python-emcee-git
    python2-pytest
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Making package: test-emcee 1-1 (Wed Mar 13 14:42:47 2019)
==> Retrieving sources...
==> Making package: test-emcee 1-1 (Wed 13 Mar 2019 02:42:47 PM UTC)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
==> Entering fakeroot environment...
==> Starting package()...
2.2.1
Starting tests...
test_blobs ...
    Passed.
test_ensemble ...
    Passed.
test_inf_nan_params ...
    Passed.
test_mh ...
    Passed.
test_nan_lnprob ...
Failed with:
    TypeError: ufunc 'isinf' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
test_parallel ...
/usr/lib/python3.7/site-packages/emcee/autocorr.py:41: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  acf = np.fft.ifft(f * np.conjugate(f), axis=axis)[m].real
/usr/lib/python3.7/site-packages/emcee/autocorr.py:43: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  return acf / acf[m]
/usr/lib/python3.7/site-packages/emcee/autocorr.py:105: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  tau = 1 + 2 * np.sum(f[m], axis=axis)
    Passed.
test_pt_sampler ...
[[16.53119245 16.75954649 15.25191474 12.73566096 23.44777261]
 [ 7.35367808  7.41932303  8.99152666  6.76095234  7.7396341 ]
 [ 2.97147613  2.91852682  2.75006461  2.3068075   2.51778795]
 [ 2.167671    1.42531942  2.44532234  1.58155128  1.2173553 ]
 [ 1.73606363  1.36376924  2.42033785  1.52387187  1.1363877 ]
 [ 1.78670758  1.1789706   2.51357147  1.59421685  1.01296884]
 [ 1.83979328  1.23874701  2.52859601  1.60909334  1.01391626]
 [ 1.8331614   1.22474614  2.64417031  1.61100936  1.03076083]
 [ 2.211445    1.45702363  3.0442844   1.91099694  1.26598485]
 [ 2.14220691  1.48037855  3.03541664  1.94899539  1.28404081]
 [ 1.76761415  1.2326919   2.6858416   1.6700447   1.03531161]
 [ 1.89355525  1.25954192  2.65169704  1.68004789  1.05885802]
 [ 2.24071474  1.46921     2.84652782  1.82793218  1.28210823]
 [ 2.20429001  1.35796525  2.90814748  1.71442054  1.2203282 ]
 [ 2.13502321  1.39193735  2.72243117  1.72401944  1.23636647]
 [ 2.00147727  1.3335517   2.6849382   1.66421486  1.23621038]
 [ 1.75310081  1.13332084  2.54200981  1.46150462  1.039411  ]
 [ 1.98386858  1.30836724  2.84065407  1.67111147  1.24431813]
 [ 1.97684374  1.2607708   2.82730529  1.70041376  1.20540196]
 [ 1.72289379  1.15532555  2.59386728  1.46536459  1.07903712]]
    Passed.
test_run_mcmc_resume ...
    Passed.
1 tests failed
....

If you remove the package python-emcee-git can you still load the module emcee in python?

Offline

#13 2019-03-13 17:09:50

andalenavals
Member
Registered: 2017-10-30
Posts: 39

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

loqs wrote:

If you remove the package python-emcee-git can you still load the module emcee in python?

I can not.

I think I found what was the issue.
I used to install all aur packages using pikaur.
when I do a sudo pacman -U packages.xz and then python -c 'import emcee; emcee.test()' I got the test running properly.
However when I run pikaur -Syu python-emcee-git...xz  nd then python -c 'import emcee; emcee.test() it does not found the attributes.

Some time ago someone suggest me install all the aur package manually instead of working with aurhelpers.
In those time yaourt was the mainstream aurhelper. Once I saw, new trustable aur helpers I give them a chance.
Do you think this is actually a aurhelper issue? could you try to install in your env using pikaur just to double check.
Cheers

Offline

#14 2019-03-13 17:32:35

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

andalenavals wrote:

Do you think this is actually a aurhelper issue? could you try to install in your env using pikaur just to double check.

I do not use any AUR helpers and I am not prepared to install one to test the issue.
It works without the use of an AUR helper and I fail to see a reason to use an AUR helper to perform an operation that pacman itself can perform.

Offline

#15 2019-03-14 12:32:32

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED pkgver() not to find proper tag. PKG doesn't find attribute

When pacman / makepkg work but an aurhelper fails, there's a problem with the aurhelper.
I suggest you report the problem at https://github.com/actionless/pikaur/issues


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB