Repository: psychopy/psychopy

Issue:
psychopy3 not opening in window 7
Error Message.


"C:\Program Files\PsychoPy3\python.exe" -m psychopy.app.psych
opyApp
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\runpy.py", line 193, in _run_module_as_ma
in
    "__main__", mod_spec)
  File "C:\Program Files\PsychoPy3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\psychopyApp.py
", line 104, in <module>
    main()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\psychopyApp.py
", line 100, in main
    start_app()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\psychopyApp.py
", line 22, in start_app
    from psychopy.app._psychopyApp import PsychoPyApp
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\_psychopyApp.p
y", line 24, in <module>
    from . import themes
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\themes\__init_
_.py", line 1, in <module>
    from ._themes import ThemeMixin, IconCache
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\themes\_themes
.py", line 16, in <module>
    from ...experiment import components
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\__init_
_.py", line 22, in <module>
    from .components import getInitVals, getComponents, getAllComponents
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\compone
nts\__init__.py", line 21, in <module>
    from ._base import BaseVisualComponent, BaseComponent
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\compone
nts\_base.py", line 21, in <module>
    from psychopy.alerts import alerttools
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\alerts\alerttools.
py", line 5, in <module>
    from psychopy.tools import monitorunittools
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\monitorunitt
ools.py", line 15, in <module>
    from psychopy import monitors
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\monitors\__init__.
py", line 10, in <module>
    from .calibTools import *
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\monitors\calibTool
s.py", line 37, in <module>
    import scipy.optimize as optim
  File "C:\Program Files\PsychoPy3\lib\site-packages\scipy\optimize\__init__.py"
, line 386, in <module>
    from .optimize import *
  File "C:\Program Files\PsychoPy3\lib\site-packages\scipy\optimize\optimize.py"
, line 37, in <module>
    from .linesearch import (line_search_wolfe1, line_search_wolfe2,
  File "C:\Program Files\PsychoPy3\lib\site-packages\scipy\optimize\linesearch.p
y", line 18, in <module>
    from scipy.optimize import minpack2
ImportError: DLL load failed: The specified module could not be found.



Discussion:
My guess is that this is another replica of #3229 which seems to be caused by bitlocker. We can't fully fix it (because the issue is ultimately with scipy) but we can mitigate the issue so that it will only bite people that need both gamma curve-fitting and bitlocker simultaneously
Please don't keep opening duplicating issues when we've already explained what's going on

Resolving patch:
diff --git a/psychopy/monitors/calibTools.py b/psychopy/monitors/calibTools.py
--- a/psychopy/monitors/calibTools.py
+++ b/psychopy/monitors/calibTools.py
@@ -34,7 +34,6 @@
 from copy import deepcopy, copy
 
 import numpy as np
-import scipy.optimize as optim
 from scipy import interpolate
 import json_tricks  # allows json to dump/load np.arrays and dates
 
@@ -746,6 +745,7 @@ def fitGammaFun(self, x, y):
             -yVals are the measured luminances from a photometer/spectrometer
 
         """
+        import scipy.optimize as optim
         minGamma = 0.8
         maxGamma = 20.0
         gammaGuess = 2.0


Test patch: