Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all dots in extensions paths are converted to slashes #55

Open
ederag opened this issue Aug 8, 2019 · 3 comments
Open

all dots in extensions paths are converted to slashes #55

ederag opened this issue Aug 8, 2019 · 3 comments

Comments

@ederag
Copy link
Contributor

ederag commented Aug 8, 2019

Trying to install b7ace27 in a virtual environment yields

Traceback (most recent call last):
  File "setup.py", line 137, in <module>
    ext_modules=cythonize(extensions),
  File "/home/ederag/share/prog/python/pyoptools/env/lib64/python3.6/site-packages/Cython/Build/Dependencies.py", line 966, in cythonize
    aliases=aliases)
  File "/home/ederag/share/prog/python/pyoptools/env/lib64/python3.6/site-packages/Cython/Build/Dependencies.py", line 810, in create_extension_list
    for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
  File "/home/ederag/share/prog/python/pyoptools/env/lib64/python3.6/site-packages/Cython/Build/Dependencies.py", line 109, in nonempty
    raise ValueError(error_msg)
ValueError: 'env/lib/python3/6/site-packages/Cython/Runtime/refnanny.pyx' doesn't match any files

The reason is that slashes are converted to dots by

pyoptools/setup.py

Lines 36 to 40 in b7ace27

def scandir(dir_, files=[]):
for file in os.listdir(dir_):
path = os.path.join(dir_, file)
if os.path.isfile(path) and path.endswith(".pyx"):
files.append(path.replace(os.path.sep, ".")[2:-4])

and then all dots (including the dot in /python3.6/) are converted back to slashes

pyoptools/setup.py

Lines 59 to 60 in b7ace27

def makeExtension(extName):
extPath = extName.replace(".", os.path.sep)+".pyx"

Is there any reason for not working directly with paths,
and converting path to name in makeExtension ?

@ederag
Copy link
Contributor Author

ederag commented Aug 8, 2019

Side note: the issue revealed itself because I created the env directory inside the project,
following this primer.

Changing this line

extNames = scandir("./")

to extNames = scandir("./pyoptools/") allows to build,
yet the installation ends with

writing top-level names to pyoptools.egg-info/top_level.txt
writing manifest file 'pyoptools.egg-info/SOURCES.txt'
error: package directory 'env/lib/python3/6/site-packages/pkg_resources' does not exist

@ramezquitao
Copy link
Member

Right now I don't exactly remember the reason I did that, but I think it has to be on how setup needs to receive the extension names.

Anyway, the idea is that setup will look automatically for all the extensions that have to be built, so if you put something else inside pyoptools source code directory, this functions will get confused.

I just tested installing the virtualenv in a different directory outside pyoptools, and everything worked as expected (kind of).

The issues I found is that the scipy version referred in the requirements file did no install from pip. I did install scipy==1.1 , other problem is that pythreejs is not in requirements.txt , and finally that jupyter is not in the requirements either.

Installing this packages in your virtualenv solves the problem.

As soon as I correct requirements.txt I will close this issue.

@ederag
Copy link
Contributor Author

ederag commented Aug 11, 2019

Then the installation instructions could mention
to avoid putting the virtual environment inside the repository ?

The issues I found is that the scipy version referred in the requirements file did no install from pip

That is probably because numpy has to be installed first.
Unfortunately, with the latest scipy,

(pyoptools) > python3 -c "from pyoptools.all import *"
...
    from scipy.misc import toimage
ImportError: cannot import name 'toimage'

and with the latest matplotlib,

(pyoptools) > python3 -c "from pyoptools.all import *"
    from pylab import griddata, meshgrid
ImportError: cannot import name 'griddata'

So for now, these dependencies have to remain constrained.

Using the updated requirements.txt proposed in PR #56, it works:

> venvwrapper -o pyoptools
(pyoptools) > export LAPACK=/usr/local/gcc-8.1.0_binutils-2.30_isl/lib64/libopenblas.so
(pyoptools) > export BLAS=/usr/local/gcc-8.1.0_binutils-2.30_isl/lib64/libopenblas.so
(pyoptools) > pip install -r requirements.txt
(pyoptools) > pip install --upgrade .

matplotlib looks for a Qt version, but these do not work inside a venv,
so to access the pyqt5 already installed globally,

pip install vext.pyqt5

Then launching the jupyter interface:

(pyoptools) > ipyoptools

In the jupyter that appear, I had to change the kernel from python2 to python3.

Then the tutorial worked fine, that looks very good, congratulations !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants