Open bhawkins opened 7 years ago
@bhawkins can you try testing out the devel branch and see if it is still an issue?
@bhawkins Hmm, I just tried to reproduce the issue with pip version of arrayfire-python and arrayfire 3.5 and there doesn't seem to be an issue. Would it be possible to download arrayfire 3.5 ?
Trying to download an OS X installer from the website is giving me trouble. When I go to https://arrayfire.com/download-splash/ and click "Login to Download" I'm taken to https://arrayfire.com/login/?redirect_to=https%3A%2F%2Farrayfire.com%2Fdownload which just says, "Get access to the ArrayFire download page by logging into your ArrayFire account. It's that easy." But I'm already logged in, and I can view my profile, etc. I tried Chrome and Safari with the same result. Is there a workaround? Otherwise I'll have to build from source, which seems like a lot of work to debug what seems like a Python problem.
Anyhow, I played around and think that I've got some issue with my Python install. Here's my test script:
from __future__ import print_function
import os
print('cwd', os.getcwd())
import arrayfire
print('cwd', os.getcwd())
print('module', arrayfire.__file__)
If I run it using my Homebrew python I get
$ /usr/local/bin/python test_af_pwd.py
cwd /Users/bhawkins/Desktop
cwd /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/Resources
module /usr/local/lib/python2.7/site-packages/arrayfire/__init__.pyc
If I create a virtualenv that uses the system site packages, I don't change directory:
$ /usr/local/bin/python -m virtualenv --system-site-packages af
New python executable in /Users/bhawkins/Desktop/af/bin/python2.7
Also creating executable in /Users/bhawkins/Desktop/af/bin/python
Installing setuptools, pip, wheel...done.
$ af/bin/python test_af_pwd.py
cwd /Users/bhawkins/Desktop
cwd /Users/bhawkins/Desktop
module /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/arrayfire/__init__.pyc
Although the import path is somehow different, it's the same code because site-packages
in the framework directory is a symlink to the one in /usr/local/lib:
$ # same inode?
$ ls -i /usr/local/lib/python2.7/site-packages/arrayfire/__init__.pyc /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/arrayfire/__init__.pyc
60161931 /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/arrayfire/__init__.pyc
60161931 /usr/local/lib/python2.7/site-packages/arrayfire/__init__.pyc
$ # yep here's the symlink
$ ls -l /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
lrwxr-xr-x 1 bhawkins admin 54 Apr 5 14:46 /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages -> ../../../../../../../../../lib/python2.7/site-packages
So this seems like a problem with me, pip, and/or homebrew, but I'm clueless as to how this happens or why I've only noticed it with arrayfire.
@bhawkins The latest installer from the ci can be downloaded from here: http://ci.arrayfire.org/userContent/OSX/
Just do not rely on it to always exist :)
@umar456 @mlloreda can you see what's happening with the downloads ?
@bhawkins can you test this with other packages ? For example numpy installed via pip ?
@bhawkins I'm not able to reproduce the download issue on my end. Can you try the following and update with results:
@pavanky I updated my test script to the following
import os, sys, imp
print('cwd', os.getcwd())
if len(sys.argv) > 1:
name = sys.argv[1]
fp, path, desc = imp.find_module(name)
imp.load_module(name, fp, path, desc)
print('cwd', os.getcwd())
I browsed pypi for a recently updated module I don't have and came up with pdfconv
. It doesn't change directory on import:
$ pip install pdfconv
Collecting pdfconv
Downloading pdfconv-1.0.0.zip
Building wheels for collected packages: pdfconv
Running setup.py bdist_wheel for pdfconv ... done
Stored in directory: /Users/bhawkins/Library/Caches/pip/wheels/f7/f2/9f/a25590d13b1d4141ef1cb966835d2ab7c178d7d8da5b2bba53
Successfully built pdfconv
Installing collected packages: pdfconv
Successfully installed pdfconv-1.0.0
$ python test_import_pwd.py pdfconv
cwd /Users/bhawkins/Desktop
cwd /Users/bhawkins/Desktop
$ python test_import_pwd.py arrayfire
cwd /Users/bhawkins/Desktop
cwd /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/Resources
@mlloreda Download seems to work now, though I'm currently on a different network. Thanks.
Importing the arrayfire module changes the working directory. For example:
This causes problems with any file names specified with a relative path.
I'm running on OS X 10.11 with arrayfire 3.3.2 installed with homebrew and arrayfire-python installed with pip.
I don't see any
chdir
calls in the module, so I'm not sure where the problem is.