ntorquet / lmt_toolkit_analysis

A tool to check the reliability and to make some analysis of data from Live Mouse Tracker (LMT) experiments.
GNU General Public License v3.0
4 stars 1 forks source link

install issue #40

Closed dhuzard closed 1 year ago

dhuzard commented 1 year ago

Hi @ntorquet ! Thanks for developping this! I'm sure it's gonna be amazing, but... as I beginner, I struggle with the install...

I never used, Django, Nuxt or Vue before, so it's hard for me to troubleshoot it fast. But here are some questions that might help me find my error(s):

Thanks for your help! Cheers, Damien

dhuzard commented 1 year ago

Hi again, Sorry, i realized my comment on the .ts is wrong. I have an additional question, do you think it would be possible to put in on a docker ? Best Damien

ntorquet commented 1 year ago

Hi @dhuzard

Thank you for your enthusiasm! I try to answer each of the points below. I am starting to answer the easiest questions and I will complete my answers as I go along :wink:

Hi @ntorquet ! Thanks for developping this! I'm sure it's gonna be amazing, but... as I beginner, I struggle with the install...

I never used, Django, Nuxt or Vue before, so it's hard for me to troubleshoot it fast. But here are some questions that might help me find my error(s):

* I had issues running the 'pip install requirements', but this might come from my conda usage... I'll figure it our later :p

I use to create a dedicated python virtual environment (that I named venv) into the root folder: see the doc here. Requirements have to be installed for this virtual environment. You have to activate this environment first with this command: python -m venv c:\path\to\myenv or venv\Scripts\activate You need two shell or command prompt to activate twice this environment, one to run Django, one to run Celery.

* It is quite confusing to have several times 'lmt_toolkit_analysis' folders, and I'm never sure when I am actually at the correct level. would it be possible to give unique names ?

* When starting the new Django Project, it cannot do it since the "lmt_toolkit_analysis" already exist. Do I have to create a new one? with a new name ? or do I have to force the use of the pre-existing "lmt_toolkit_analysis" Django project ?

* The install of vuetify@Next sass did not work. I kept having a ETARGET error message

* The npm run dev did not work either, becuase of 'unknown' dev.

After installing nuxt, did you go under the nuxt folder before trying to do npm run dev?

* Is it normal that the file create is a Nuxt.config.ts and not .js ?

* I had to add an import os in the settings.py file.

You are right! I have to had this information to the readme. Sorry for this omission.

* Finally, I did not find the datatostart.json file (but at that point I am completely confused and lost in the folders :p )

datatostart.json is in the fixtures folder: lmt_toolkit_analysis/lmt_toolkit_analysis/fixtures/datatostart.json Normally, when you do this python manage.py loaddata datatostart.json, django will find the fixtures folder as the default folder to load the data.

Thanks for your help! Cheers, Damien

ntorquet commented 1 year ago

Hi again, Sorry, i realized my comment on the .ts is wrong. I have an additional question, do you think it would be possible to put in on a docker ? Best Damien

it's something I've thought about but haven't looked into yet. :wink:

ntorquet commented 1 year ago

Documentation was improved, and some Django files are added. The Django part of the installation is much easier now.

dhuzard commented 1 year ago

Thanks @ntorquet , the Django part is indeed much easier. However, when I start the Django server and follow the link, I have a error "Page not Found (404)"

Again, here, I would suggest have different "lmt_toolkit_analysis" folder names (Like "lmt_toolkit_analysis-1" and "lmt_toolkit_analysis-2").

I think I mostly struggle with Celery now.

i am not sure at which level I have to run celery -A lmt_toolkit_analysis worker -l info -P solo ? In the "lmt_toolkit_analysis" folder containing celery.py or in the "lmt_toolkit_analysis" containing the second "lmt_toolkit_analysis" ? When I ran the command: I either add, the celery.py opening or I had a "connection to broker lost" error.

Then the Nuxt Vue seems to work, but I cannot confirm since it required the celery which bugged.

Thanks again for your help! Damien

dhuzard commented 1 year ago

Little update from my side:

(venv) (base) C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\lmt_toolkit_api>python manage.py loaddata fixtures/datatostart.json
Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    main()
  File "manage.py", line 27, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 102, in handle
    self.loaddata(fixture_labels)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 163, in loaddata
    self.load_label(fixture_label)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 251, in load_label
    for obj in objects:
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\serializers\json.py", line 67, in Deserializer
    stream_or_string = stream_or_string.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 966: invalid start byte

I'll see what I can find later... ;)

dhuzard commented 1 year ago

Another comment/question: do you think that installing Erlang and RabbitMQ could be better if performed before ? And I notice that I had issue to install RabbitMQ with the windows .exe, but it did work with the chololatery command ('choco install RabbitMQ').

ntorquet commented 1 year ago
* comment on the activation of the venv, one s is missing: `venv\Scripts\activate`

Corrected! (on the dev branch for now)

* BUT, now I have another error, when running the `python manage.py loaddata fixtures/datatostart.json` :
(venv) (base) C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\lmt_toolkit_api>python manage.py loaddata fixtures/datatostart.json
Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    main()
  File "manage.py", line 27, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 102, in handle
    self.loaddata(fixture_labels)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 163, in loaddata
    self.load_label(fixture_label)
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 251, in load_label
    for obj in objects:
  File "C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\django\core\serializers\json.py", line 67, in Deserializer
    stream_or_string = stream_or_string.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 966: invalid start byte

This is an encoding problem. You can open the fixtures/datatostart.json with an editor and change its encoding. I will put a new datatostart.json file with the good encoding.

dhuzard commented 1 year ago

Another comment/question: do you think that installing Erlang and RabbitMQ could be better if performed before ? And I noticed that I had an issue while installing RabbitMQ with the windows .exe file, but it did work with the chololatery command ('choco install RabbitMQ').

ntorquet commented 1 year ago

Another comment/question: do you think that installing Erlang and RabbitMQ could be better if performed before ? And I noticed that I had an issue while installing RabbitMQ with the windows .exe file, but it did work with the chololatery command ('choco install RabbitMQ').

I don't think that there is a specific order to installErlang and RabbitMQ. The way to install it doesn't matter. So now RabbitMQ is working properly on your computer? Did you try LMT-toolkit?

dhuzard commented 1 year ago

I do think my issue is from RabbitMQ (that might not have the proper rights to connect to the Django server, or something like that if it exists...)

So I try to remove everything and start from scratch, here are few new comments:

dev nuxt dev

'nuxt' is not recognized as an internal or external command, operable program or batch file.'

dhuzard commented 1 year ago

Nuxt "kind of worked" :): 'Nuxi 3.5.2 13:56:39 Nuxt 3.5.2 with Nitro 2.4.1 13:56:39 13:56:40

Local: http://localhost:3000/ Network: http://10.7.16.202:3000/

i Vite client warmed up in 1089ms 13:56:42 √ Nitro built in 646 ms nitro 13:56:42 √ Vite server hmr 19 files in 491.244ms 13:56:50 ' But I cannot see the LMT app yet

dhuzard commented 1 year ago

my celery output: '(venv) C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\lmt_toolkit_api>celery -A lmt_toolkit_analysis worker -l info -P solo [2023-06-05 13:54:50,346: WARNING/MainProcess] No hostname was supplied. Reverting to default 'localhost'

-------------- celery@igf-1289 v5.2.7 (dawn-chorus) --- * ----- -- *** ---- Windows-10-10.0.19044-SP0 2023-06-05 13:54:50

[tasks] . lmt_toolkit_analysis.celery.debug_task . lmttoolkitanalysis.tasks.analyseProfileFromStartTimeToEndTime . lmttoolkitanalysis.tasks.getAnalysis . lmttoolkitanalysis.tasks.getReliability . lmttoolkitanalysis.tasks.rebuildSQLite . lmttoolkitanalysis.tasks.saveAnimalInfoTask

[2023-06-05 13:54:50,367: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672// [2023-06-05 13:54:50,389: INFO/MainProcess] mingle: searching for neighbors [2023-06-05 13:54:50,393: WARNING/MainProcess] No hostname was supplied. Reverting to default 'localhost' [2023-06-05 13:54:51,408: INFO/MainProcess] mingle: all alone [2023-06-05 13:54:51,418: WARNING/MainProcess] C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\venv\lib\site-packages\celery\fixups\django.py:203: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments! warnings.warn('''Using settings.DEBUG leads to a memory

[2023-06-05 13:54:51,418: INFO/MainProcess] celery@igf-1289 ready. '

dhuzard commented 1 year ago

And a new Nuxt error :') image

ntorquet commented 1 year ago

Celery is running well, meaning that RabbitMQ works properly. Did you copy all the files from Github in the nuxt-frontend folder after installating the nuxt environment?

ntorquet commented 1 year ago

In the nuxt-frontend folder, the package.json file should be like that:

{ "name": "nuxt-app", "private": true, "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "devDependencies": { "@types/node": "^18", "nuxt": "^3.5.1" }, "dependencies": { "@mdi/font": "^7.2.96", "@pinia/nuxt": "^0.4.11", "axios": "^1.4.0", "chart.js": "^4.3.0", "install": "^0.13.0", "pinia": "^2.1.3", "sass": "^1.62.1", "vue-chartjs": "^5.2.0", "vue-json-csv": "^2.1.0", "vuetify": "^3.3.1" }, "overrides": { "vue": "latest" } }

dhuzard commented 1 year ago

maybe my Final comments on the install: It finally worked when I created a nuxt-frontend-new folder. (Before that I kept a nuxt-frontend-old folder copy). I ran all the npm commands. Then I ran the 3 command prompts. I encountered the Nuxt error, and this is when I copy-pasted the containt of uxt-frontend-old into nuxt-frontend-new (and replaced the existing files!) And now it is running!

Also, before the Nuxt command you should add to activate the venv as well.

We will try a Paul's computer soon to see if we can replicate the install with our few modifications ;)

ntorquet commented 1 year ago

Thank you for your feedback, @dhuzard ! Just a clarification: nuxt doesn't need the venv activation: nuxt is a javascript framework, it uses Node.js as its runtime environment :wink: