architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
194 stars 61 forks source link

Importing Database via the Database initializer not possible #3509

Closed KFSchlager closed 5 months ago

KFSchlager commented 6 months ago

Describe the bug Not possible to browse for Databases path (sign to klick on it appears, but left klick doesn't open anything) Only CH and SG Databases show up When running Script with CH or SG Database an Error occurs:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'project path ...\inputs\technology\archetypes\CONSTRUCTION_STANDARD.xlsx'

To Reproduce Steps to reproduce the behavior:

  1. Go to Database editor
  2. Click on Import Database
  3. Try selecting databases path: + Browse for databases path
  4. select CH or SG
  5. Run Script
  6. See error

Expected behaviour should be able to select databases path should be able to initialize the Database

Screenshots grafik

Hardware (please complete the following information):

reyery commented 6 months ago

Hi @KFSchlager,

For the "+ Browse for databases path" button bug, we have fixed it for the GUI but you would have to manually update it on your end for now, without having to reinstall it.

You can extract the attached file and replace the app.asar file that is found in your CEA installation path: e.g.

C:\Users\foobar\Documents\CityEnergyAnalyst\dashboard\resources\app.asar

app.asar.zip

Let me know if that works for you.

KFSchlager commented 6 months ago

Hi @reyery yes, that worked. Thank you very much!

KFSchlager commented 6 months ago

Hi @reyery

the PermissionError still occurs, but the "+ Browse for databases path" button works now.

reyery commented 6 months ago

Hi @KFSchlager, would you mind sharing me the whole log of the script that produces the error? I am not able to reproduce it on my end.

reyery commented 6 months ago

I will close this issue for now. Let me know if it is still an issue.

moaapplepie commented 6 months ago

Hej! This is also an issue for me, and it does not work to replace the app.asar for me, when I try it then I can't open the CEA dashboard anymore. Only way to get back into the CEA is to re-install it, but face the same issue when I try to import any database.

This is the error:

Job Output for 1 - data-initializer
City Energy Analyst version 3.35.4
Running `cea data-initializer` with the following parameters:
- general:scenario = C:\Users\moma0061\Videos\reference-case-open\TEST0307\test1
  (default: {general:project}\{general:scenario-name})
Traceback (most recent call last):
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\setuptools\_distutils\file_util.py", line 33, in _copy_file_contents
    os.unlink(dst)
PermissionError: [WinError 32] Det går inte att komma åt filen eftersom den
används av en annan process: 'C:\\Users\\moma0061\\Videos\\reference-case-open\\TEST0307\\test1\\inputs\\technology\\archetypes\\CONSTRUCTION_STANDARD.xlsx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 146, in worker
    run_job(config, job, server)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 108, in run_job
    script(config=config, **parameters)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 60, in __call__
    self._runner.__call__(*args, **kwargs)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 38, in script_runner
    script_module.main(config)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\data_initializer.py", line 70, in main
    data_initializer(locator=locator,
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\data_initializer.py", line 42, in data_initializer
    copy_tree(complete_databases_path, complete_output_directory)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\setuptools\_distutils\dir_util.py", line 185, in copy_tree
    copy_file(
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\setuptools\_distutils\file_util.py", line 163, in copy_file
    _copy_file_contents(src, dst)
  File "C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\setuptools\_distutils\file_util.py", line 35, in _copy_file_contents
    raise DistutilsFileError(
distutils.errors.DistutilsFileError: could not delete 'C:\Users\moma0061\Videos\reference-case-open\TEST0307\test1\inputs\technology\archetypes\CONSTRUCTION_STANDARD.xlsx': Det går inte att komma åt filen eftersom den
används av en annan pro- data-initializer:databases-path = C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\databases\CH
  (default: )
- data-initializer:databases = ['archetypes', 'assemblies', 'components']
  (default: ['archetypes', 'assemblies', 'components'])
Running data-intializer with scenario = C:\Users\moma0061\Videos\reference-case-open\TEST0307\test1
Running data-intializer with databases located in = C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\databases\CH
Copying databases from C:\Users\moma0061\Videos\dependencies\micromamba\envs\cea\lib\site-packages\cea\databases\CH
Copying databases to C:\Users\moma0061\Videos\reference-case-open\TEST0307\test1\inputs\technology
ShiZhongming commented 6 months ago

Hi @moaapplepie

Thanks for raising this. It looks like it is not a unique case now..

Currently, @reyery tried a few times to replicate the error and we still could not..We will dig into it. During the installation process, did you select "install for everyone" or "install for me only"?

moaapplepie commented 6 months ago

Hej @ShiZhongming and @reyery.

Thank you for your swift response, and help with this issue! I think I chose "install for me only" :)

KFSchlager commented 6 months ago

Hi, I think i chose "install for me only" too

KFSchlager commented 6 months ago

My error log is the following:


City Energy Analyst version 3.35.4 Running cea data-initializer with the following parameters:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 146, in worker run_job(config, job, server) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 108, in run_job script(config=config, *parameters) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 60, in call self._runner.call(args, **kwargs) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 38, in script_runner script_module.main(config) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\data_initializer.py", line 70, in main data_initializer(locator=locator, File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\data_initializer.py", line 48, in data_initializer copy_tree(complete_databases_path, complete_output_directory) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\setuptools_distutils\dir_util.py", line 185, in copy_tree copy_file( File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\setuptools_distutils\file_util.py", line 163, in copy_file _copy_file_contents(src, dst) File "C:\Program Files\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\setuptools_distutils\file_util.py", line 35, in _copy_file_contents raise DistutilsFileError( distutils.errors.DistutilsFileError: could not delete 'C:\Users\user\Downloads\08032024test\1test\inputs\technology\components\CONVERSION.xlsx': Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird

reyery commented 5 months ago

This should be resolved in the new version v3.35.5. Let me know if it is still an issue.