ntorquet/lmt_toolkit_analysis

install issue

dhuzard opened this issue ยท 18 comments

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
  • 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.
  • 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.
  • Finally, I did not find the datatostart.json file (but at that point I am completely confused and lost in the folders :p )

Thanks for your help!
Cheers,
Damien

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

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 ๐Ÿ˜‰

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

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. ๐Ÿ˜‰

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

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)"

  • after activating the venv, are you sure we have to run cd lmt_toolkit_analysis ? I think it is going 'too far' in the folders.

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

Little update from my side:

  • comment on the activation of the venv, one s is missing: venv\Scripts\activate
  • it seems that the celery version should be higher than 3 to work. I managed to run the 'python manage.py makemigrations' command by adding 'Celery==5.2.7' in the requirements.txt file.
  • 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

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

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').

* 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.

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').

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?

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:

  • it seems that python 3.11 is too much to run the requirement.txt (i'll try with 3.10.11 from today).
  • Install Python, Erlang and RabbitMQ with Admin rights ... (but I have an issue, I cannot modify some RabbitMQ .bat files with my computer rights...). And there might be an issue here!
  • I force Celery version to Celery==5.2.7 in the requirements.txt file
  • Using the virtualenv command worked, however I have to manually change the datatostart.json into UTF-8.
  • For the nuxt-frontend, If I follow your recommendation and rename the original one to "nuxt-frontend-old", then create "nuxt-fronted" with 'npx nuxi@latest init nuxt-frontend', then 'ctr-C' from "nuxt-frontend-old" and 'Ctrl-V' in the new "nuxt-fronted" (and Replacing All the existing ones): I cannot run the 'npm i' Command. however, if I create a new "nuxt-frontend" I can run 'npm i' ... => I don't understant why and what I am losing without you pre-existing files from your "nuxt-frontend" folder.
  • For the 'npm install pinia @pinia/nuxt' command, I have to force it, because there was some
    'npm ERR! Could not resolve dependency:
    npm ERR! pinia@"*" from the root project'
    I forced it with the command: 'npm install pinia @pinia/nuxt --force' and it worked.
  • All other npm installs worked well
  • With this: I can run the Django server, and the Celery. Now I have an issue with Nuxt...
    '(venv) C:\Users\uid-1323\Documents\GitHub\lmt_toolkit_analysis-dev\nuxt-frontend>npm run dev

dev
nuxt dev

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

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

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

  • *** --- * ---
  • ** ---------- [config]
  • ** ---------- .> app: lmttoolkitanalysis:0x2539d8fb520
  • ** ---------- .> transport: amqp://guest:**@localhost:5672//
  • ** ---------- .> results:
  • *** --- * --- .> concurrency: 16 (solo)
    -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
    --- ***** -----
    -------------- [queues]
    .> celery exchange=celery(direct) key=celery

[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.
'

And a new Nuxt error :')
image

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?

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"
}
}

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 ;)

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 ๐Ÿ˜‰