lusob / obsidian-brain

MIT License
12 stars 1 forks source link

"brAIn server connection error: Port 9000 in use by another device." #2

Open u202210066 opened 1 year ago

u202210066 commented 1 year ago

image "brAIn is not running, please check that the port 9000 is not being used by other device" I followed the instructions, entered the key in the brAIn options space, executed the first ingest command, but the second one gave me an error about port 9000 or something like that. I don't know anything about programming, please help.

lusob commented 1 year ago

Could you give me a little more information? like the OS and the type of cpu of your computer? (intel, apple m1/2), it could be due to you don't have docker installed in your computer, having docker is a requirement

kubo1361 commented 1 year ago

Hello, I encountered a similar problem.

The first issue was that the system did not recognize "|| true" in Docker commands like await docker.command('rm brain || true');. I resolved this issue by removing "|| true" and using two separate try-catch blocks for the removal and creation processes.

Secondly, I had a space in my Windows path, which Docker did not accept. So, I modified it as follows:

Original:

await docker.command(run -d --name brain -p 9000:9000 -v ${vaultPath}:${vaultPath} -e MARKDOWN_FILES=${vaultPath} -e OPENAI_API_KEY=${openaiApiKey} -e IS_OBSIDIAN_VAULT=1 -t lusob04/brain);

Fixed:

await docker.command(run -d --name brain -p 9000:9000 -v \"${vaultPath}:/obsidian\" -e MARKDOWN_FILES=/obsidian -e OPENAI_API_KEY=${openaiApiKey} -e IS_OBSIDIAN_VAULT=1 -t lusob04/brain);

I applied the same fix for the ingestion and chatting sections, and it works now.

gilipsy commented 1 year ago

same problem - "brAIn is not running, please check that the port 9000 is not being used by other device" mac m1 and i have docker

RicardoJPC8 commented 1 year ago

same

Acknar commented 1 year ago

Can you please detail what must be done with docker apart from installing and creating an account, in order to get this to work? Your installation video doesn't show what must be done on that end

pablobroon commented 1 year ago

Same issue here. Tried it on different devices with Windows and with different firewalls. All gave the same error message.

mashean commented 1 year ago

Looking forward to trying out this plugin however like the previous posts, getting the "port 9000" issue. Has anyone been able to get this to work without making code changes that kubo1361 suggested? like others here, have docker yet can't get past this issue...thanks!

lusob commented 1 year ago

I've created a multiarch docker image and released a new version (1.0.3) wiht some improvements and some fixes related with docker. I've tried in MacOS (m2) and linux (x86) sucessfully.

  1. Remove the docker image with docker rmi -f lusob04/brain
  2. Remove the vectorestore.pkl file from your root folder vault (if exists)
  3. Install/Upgrade the obsidian brain plugin to the 1.0.3 version
  4. In obsidian run the brAIn: Ingest vault docs command (Now by default it generates the embeddings locally, it could take time)
  5. In obsidian run the brAIn: Open chatcommand
mashean commented 1 year ago

Thank you. Total noob. I'm assuming I actually need a container to be running (?). Did manage to pull the brain server but when running it I get the following error:

2023-06-29 20:56:43 INFO: Started server process [1] 2023-06-29 20:56:43 INFO: Waiting for application startup. 2023-06-29 20:56:43 ERROR: Traceback (most recent call last): 2023-06-29 20:56:43 File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 677, in lifespan 2023-06-29 20:56:43 async with self.lifespan_context(app) as maybe_state: 2023-06-29 20:56:43 File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 566, in aenter 2023-06-29 20:56:43 await self._router.startup() 2023-06-29 20:56:43 File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 654, in startup 2023-06-29 20:56:43 await handler() 2023-06-29 20:56:43 File "/app/main.py", line 30, in startup_event 2023-06-29 20:56:43 vectorstore_path = os.path.join(os.environ.get("MARKDOWN_FILES"), "vectorstore.pkl") 2023-06-29 20:56:43 File "/usr/local/lib/python3.9/posixpath.py", line 76, in join 2023-06-29 20:56:43 a = os.fspath(a) 2023-06-29 20:56:43 TypeError: expected str, bytes or os.PathLike object, not NoneType 2023-06-29 20:56:43 2023-06-29 20:56:43 ERROR: Application startup failed. Exiting.

Sorry wished i knew a little more on how to get the backend to work. Would love to try out the plugin :)

lusob commented 1 year ago

Hi @mashean, the brain container is pulled automatically when you run a brAIn command from obsidian, remember you have to run brAIn: Ingest vault docs command first to generate a vectorstore.pkl file before open a chat.

In case you want to run it manually you have to set the environment variables, in your example you should set first MARKDOWN_FILES with the path to your vault (export MARKDOWN_FILES=\</path-to-your-obsidian-vault>)

santiyounger commented 1 year ago

Thanks to everyone who tried to share steps to get it to work. I would love to use this plugin, what @Acknar said in his comment would be much appreciated:

Can you please detail what must be done with Docker, apart from installing and creating an account, in order to get this to work? Your installation video doesn't show what must be done on that end.

I'm personally on Windows. I haven't used Docker before. I can probably figure it out if I spend a few hours, but if we could have detailed instructions or if the process becomes simpler in the future, that would be incredible.

Either way, thanks @u202210066 for putting this plugin together. I've been looking forward to something like this and can't wait to try it.

etcook commented 1 year ago

I too am trying to get this to work, but I'm not sure how to even debug. When I try to ingest, the modal is up for about a second and then disappears without a trace. Then when trying to run a chat, I get the same error everyone else is getting. I'm on an m1 MacBook Pro.