title: ImportError: cannot import name _remove_dead_weakref - no error when running python script.py, error when running script.py from bash shell script
body: <p>I am trying to import a package that requires sklearn. This is in a test script named script.py. When I run: <code>python script.py allele_1</code>, I do not get an error. However, when I include this command inside a bash shell script as follows:</p>
  
  <pre><code>#!/bin/bash
  allele=($(ls $1 | grep H))
  python script.py $allele
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>File "/home/jhuang/miniconda2/lib/python2.7/site- 
  packages/mhcnuggets/src/dataset.py", line 12, in &lt;mod                                                                                              
  ule&gt;
  from sklearn.model_selection import train_test_split
  File "/home/jhuang/miniconda2/lib/python2.7/site- 
  packages/sklearn/__init__.py", line 20, in &lt;module&gt;
    import logging
  File "/home/jhuang/miniconda2/lib/python2.7/logging/__init__.py", line 26, in 
  &lt;module&gt;
  import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/home/jhuang/miniconda2/lib/python2.7/weakref.py", line 14, in &lt;module&gt;
  from _weakref import (
  ImportError: cannot import name _remove_dead_weakref
  </code></pre>
  
  <p>I've seen similar questions, but have not seen a definitive answer, nor have I seen any question in the context of command line vs shell script execution. Any help would be greatly appreciated!</p>