psychopy.org | Reference | Downloads | Github

Import error: openpyxl is required to load the excel format files

I am running psychopy 1.84.1 and anaconda spyder python 2.7 on 64 bit windows 10. I am getting import error of openpyxl. I was having one program with the name openpyxl which i have deleted as well as its .pyc file. I have also uninstall and reinstall openpyxl module from anaconda promt but still same error is coming. I am posting the code and the traceback. It would be helpful if some one can give me some idea to solve this error.

  base_dir =  os.path.normpath('C:\\Users\\ravikumar.mevada\\Gustometer\\qmix\\examples')
    conditions_file = os.path.join(base_dir, 'fat_taste.xlsx')
    data_dir = os.path.join(base_dir, 'Data_out_fat')
    outfile = os.path.join(data_dir,'output_fat_taste')
    
    #import .xlsx file
    conditions = data.importConditions(conditions_file)
    
    #screen resolution #TODO: not used
    width = GetSystemMetrics(0) 
    height = GetSystemMetrics(1)
    
    #assign to each taste a specific pump
    tastants_pumps = {'sweet1':pump_1,'sweet2':pump_3,'sweet3':pump_4, 'water':pump_5}
Traceback (most recent call last):

  File "<ipython-input-9-291e52893b5d>", line 7, in <module>
    conditions = data.importConditions(conditions_file)

  File "C:\Users\ravikumar.mevada\Anaconda2\lib\site-packages\psychopy\data.py", line 2667, in importConditions
    raise ImportError('openpyxl is required for loading excel '

ImportError: openpyxl is required for loading excel format files, but it was not found.

Well, it sounds like openpyxl is not installed properly. Maybe installed to a different Python? You need to use the anaconda help though, as this really doesn’t look like a PsychoPy problem

It got solved by uninstalling and reinstalling the openpyxl. Thank you vary much.