8000 distutils.misc_util.get_info("npymath") returns double backslashes in path when venv is on a network share · Issue #18360 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

distutils.misc_util.get_info("npymath") returns double backslashes in path when venv is on a network share #18360

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

Open
syagev opened this issue Feb 7, 2021 · 3 comments

Comments

@syagev
Copy link
syagev commented Feb 7, 2021

If numpy is installed in a venv which is hosted on a network share on Windows, it seems distutils.misc_util.get_info returns the path with double-backslashes as a path separator. This breaks modules that depend on this output in order to set include and lib paths during compilation (e.g. hmmlearn).

Reproducing code example:

from numpy.distutils.misc_util import get_info
print(get_info("npymath"))

>>> {'include_dirs': ['\\\\\\\\ilabs-htcfs\\\\Shared\\\\styagev\\\\.virtualenvs\\\\OfflineSystem-B.38\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\include'], 'library_dirs': ['\\\\\\\\ilabs-htcfs\\\\Shared\\\\styagev\\\\.virtualenvs\\\\OfflineSystem-B.38\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\lib'], 'libraries': ['npymath'], 'define_macros': []}

The correct path for the npymath library is \\ilabs-htcfs\Shared\styagev\.virtualenvs\OfflineSystem-B.38\lib\site-packages\numpy\core\lib

NumPy/Python version information:

1.20.0 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]

@eric-wieser
Copy link
Member

I don't really understand the codepath yet, but these escape calls look very suspicious to me:

def cflags(self, section="default"):
val = self.vars.interpolate(self._sections[section]['cflags'])
return _escape_backslash(val)
def libs(self, section="default"):
val = self.vars.interpolate(self._sections[section]['libs'])
return _escape_backslash(val)

@eric-wieser
Copy link
Member

It looks like those lines are indeed the cause, and they were introduced by #4451, which was a revert of a previous attempt to fix this, #4421

@mattip
Copy link
Member
mattip commented Feb 8, 2021

While #4421 added some tests, it seems they were insufficient, which led to the revert.

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

No branches or pull requests

3 participants
0