Repository: cupy/cupy

Issue:
import cupy 9.0.0a2 doesn't work on Windows 10
Thank you for using and contributing to CuPy!

If your issue is a **request for support in using CuPy**, please post it on [Stack Overflow](https://stackoverflow.com/questions/tagged/cupy) or Google Groups ([en](https://groups.google.com/forum/#!forum/cupy) / [ja](https://groups.google.com/forum/#!forum/cupy-ja)).
Developer team members are monitoring questions on these channels.

If it is a bug report, please include the following information:

* Conditions (you can just paste the output of `python -c 'import cupy; cupy.show_config()'`)
  - CuPy version **9.0.0a2**
  - OS/Platform: **Windows 10**
  - CUDA version: **10.2**
  - cuDNN/NCCL version (if applicable)
* Code to reproduce
```python
>>> import cupy
```
* Error messages, stack traces, or logs
```bash
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Amin\anaconda3\envs\py38\lib\site-packages\cupy\__init__.py", line 57, in <module>
    from cupy import fft  # NOQA
  File "C:\Users\Amin\anaconda3\envs\py38\lib\site-packages\cupy\fft\__init__.py", line 1, in <module>
    from cupy.fft._fft import fft  # NOQA
  File "C:\Users\Amin\anaconda3\envs\py38\lib\site-packages\cupy\fft\_fft.py", line 9, in <module>
    from cupy.fft import config
  File "C:\Users\Amin\anaconda3\envs\py38\lib\site-packages\cupy\fft\config.py", line 13, in <module>
    from cupy.fft._callback import get_current_callback_manager  # NOQA
  File "cupy\fft\_callback.pyx", line 35, in init cupy.fft._callback
AttributeError: 'NoneType' object has no attribute 'split'
```



Discussion:
Hi @ma-sadeghi Thanks for reporting! This is surprising, could you help me debug it? I need to know the output of the following snippet on Windows:
```python
import sysconfig
sysconfig.get_config_var('CXX')
```
@leofang Thank you for your quick reply. It returns `None`. If it helps, when I install the stable version, `import cupy` works fine.
Thanks! Right, this callback module is new, so it's not included in the v8 releases. I will push a fix.

Resolving patch:
diff --git a/cupy/fft/config.py b/cupy/fft/config.py
--- a/cupy/fft/config.py
+++ b/cupy/fft/config.py
@@ -9,9 +9,12 @@
 from cupy.fft._cache import set_plan_cache_max_memsize  # NOQA
 from cupy.fft._cache import show_plan_cache_info  # NOQA
 
-# expose callback handles to this module
-from cupy.fft._callback import get_current_callback_manager  # NOQA
-from cupy.fft._callback import set_cufft_callbacks  # NOQA
+# on Linux, expose callback handles to this module
+import sys
+if sys.platform.startswith('linux'):
+    from cupy.fft._callback import get_current_callback_manager  # NOQA
+    from cupy.fft._callback import set_cufft_callbacks  # NOQA
+del sys
 
 
 enable_nd_planning = True
diff --git a/cupy_setup_build.py b/cupy_setup_build.py
--- a/cupy_setup_build.py
+++ b/cupy_setup_build.py
@@ -600,6 +600,9 @@ def make_extensions(options, compiler, use_cython):
             s_file = copy.deepcopy(s)
             name = module_extension_name(f)
 
+            if name.endswith('fft._callback') and not PLATFORM_LINUX:
+                continue
+
             rpath = []
             if not options['no_rpath']:
                 # Add library directories (e.g., `/usr/local/cuda/lib64`) to


Test patch: