0 Replies
a year ago
what version of python do you use locally?
a year ago
nixpacks doesnt support python 3.12 yet, so instead add 3.11
to a runtime.txt file
a year ago
python-magic-bin 0.4.14 if from 2017
a year ago
yeah, but may i ask why?
a year ago
i would highly recommend using something pure python thats more up to date
On the python-magic github it says on Debian/Ubuntu to use sudo apt-get install libmagic1
, i just didnt know if i could apt-get something on railway so i was trying to do it without using it
I am using something from 7 years ago right now and it is just too outdated so I was hoping to get something a little newer
a year ago
the -bin
version would include libmagic1
a year ago
im now thinking python-magic-bin is not compatible with python 3.8+
a year ago
its already installed, so of course it will work lol
a year ago
its already installed
a year ago
what os are you using?
a year ago
might not support ubuntu
a year ago
use this
and then place this nixpacks.toml file in your project -
[phases.setup]
aptPkgs = ['...', 'libmagic1']
Im getting an Import error now, ```
File "/app/Routes/fileUploads.py", line 10, in
import magic
File "/opt/venv/lib/python3.11/site-packages/magic/init.py", line 209, in
libmagic = loader.load_lib()
^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/magic/loader.py", line 49, in load_lib
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation```
a year ago
build logs please
a year ago
is this a web app of some kind?
a year ago
flask? fastapi?
a year ago
why arent you using gunicorn?
a year ago
haha im tired too, i meant uvicorn
a year ago
the fastapi constructor is named app right?
a year ago
nixpacks is being difficult, we are moving to a Dockerfile, add this as a Dockerfile to your project -
FROM python:3.12
ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libmagic1
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . ./
CMD uvicorn main:app --host 0.0.0.0 --port $PORT
(you can delete the nixpacks.toml file)
Okay, ive never toucher dockerfiles so i dont knwo them well. What do i name the file? Just Dockerfile
?
a year ago
correct
a year ago
as you can see, its just a set of commands that setup the project, super simple stuff
a year ago
not as finicky as nixpacks
a year ago
no problem!
a year ago
Dockerfiles are always the answer
a year ago
you too!!