Python malloc error with iPython
🐛 Bug
When in iPython, doing:
from pytorch_lightning import Trainer
or
import pytorch_lightning
gives:
In [1]: from pytorch_lightning import Trainer
python(82101,0x10e7f1dc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744071734263808, flags: 100) failed (error code=3)
python(82101,0x10e7f1dc0) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-9a5a68534ecc> in <module>
----> 1 from pytorch_lightning import Trainer

~/opt/anaconda3/lib/python3.7/site-packages/pytorch_lightning/__init__.py in <module>
     54     # We are not importing the rest of the lightning during the build process, as it may not be compiled yet
     55 else:
---> 56     from pytorch_lightning import metrics
     57     from pytorch_lightning.callbacks import Callback
     58     from pytorch_lightning.core import LightningDataModule, LightningModule

~/opt/anaconda3/lib/python3.7/site-packages/pytorch_lightning/metrics/__init__.py in <module>
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
---> 14 from pytorch_lightning.metrics.metric import Metric
     15 
     16 from pytorch_lightning.metrics.classification import (

~/opt/anaconda3/lib/python3.7/site-packages/pytorch_lightning/metrics/metric.py in <module>
     21 
     22 import os
---> 23 import torch
     24 from torch import nn
     25 

~/opt/anaconda3/lib/python3.7/site-packages/torch/__init__.py in <module>
    188     if USE_GLOBAL_DEPS:
    189         _load_global_deps()
--> 190     from torch._C import *
    191 
    192 # Appease the type checker; ordinarily this binding is inserted by the

ImportError: numpy.core.multiarray failed to import
Though, when just using Python in terminal, does not have the same results and the import is happening as it should be.
This is a problem because different tools (e.g. Vimspector debugging tool) cannot as well import Trainer and have the exact same error.
To Reproduce
Install pytorch-lightning, open iPython, import Trainer from pytorch_lightning.
Expected behavior
The importing should happen normally, without errors.
Environment
* CUDA:
	- GPU:
	- available:         False
	- version:           None
* Packages:
	- numpy:             1.19.2
	- pyTorch_debug:     True
	- pyTorch_version:   1.7.0
	- pytorch-lightning: 1.0.7
	- tqdm:              4.51.0
* System:
	- OS:                Darwin
	- architecture:
		- 64bit
		- 
	- processor:         i386
	- python:            3.7.9
	- version:           Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64