I am attempting to dockerize this workflow of isomorphic app.
I build the container of below docker file.
FROM python:3.5-slim
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
apt-get -y install vim && \
apt-get -y install nano && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /statics/js
VOLUME ["/statics/"]
WORKDIR /statics/js
COPY requirements.txt /opt/requirements.txt
RUN pip install -r /opt/requirements.txt
EXPOSE 8080
CMD ["python", "/statics/js/app.py"]
and this was the result:
$ docker build -t ciasto/pythonreact:v2 .
Sending build context to Docker daemon 1.327 MB
Step 1/9 : FROM python:3.5-slim
---> b27a94c44674
Step 2/9 : RUN apt-get update && apt-get -y install gcc mono-mcs && apt-get -y install vim && apt-get -y install nano && rm -rf /var/lib/apt/lists/*
---> Using cache
---> c76cb348707c
Step 3/9 : RUN mkdir -p /statics/js
---> Using cache
---> 2ef5b24f551c
Step 4/9 : VOLUME /statics/
---> Using cache
---> 5e62c6af1867
Step 5/9 : WORKDIR /statics/js
---> Using cache
---> a5a018e8c727
Step 6/9 : COPY requirements.txt /opt/requirements.txt
---> Using cache
---> 1fa4dccc6608
Step 7/9 : RUN pip install -r /opt/requirements.txt
---> Running in 8845a0efcee7
Collecting TurboGears2==2.3.10 (from -r /opt/requirements.txt (line 1))
Downloading TurboGears2-2.3.10.tar.gz (176kB)
Collecting Kajiki==0.6.3 (from -r /opt/requirements.txt (line 2))
Downloading Kajiki-0.6.3.tar.gz (174kB)
Collecting tgext.webassets==0.0.2 (from -r /opt/requirements.txt (line 3))
Downloading tgext.webassets-0.0.2.tar.gz
Collecting dukpy==0.1.0 (from -r /opt/requirements.txt (line 4))
Downloading dukpy-0.1.0.tar.gz (2.0MB)
Collecting WebOb>=1.2 (from TurboGears2==2.3.10->-r /opt/requirements.txt (line 1))
Downloading WebOb-1.7.2-py2.py3-none-any.whl (83kB)
Collecting crank<0.9.0,>=0.8.0 (from TurboGears2==2.3.10->-r /opt/requirements.txt (line 1))
Downloading crank-0.8.1.tar.gz
Collecting repoze.lru (from TurboGears2==2.3.10->-r /opt/requirements.txt (line 1))
Downloading repoze.lru-0.6.tar.gz
Collecting MarkupSafe (from TurboGears2==2.3.10->-r /opt/requirements.txt (line 1))
Downloading MarkupSafe-1.0.tar.gz
Collecting nine (from Kajiki==0.6.3->-r /opt/requirements.txt (line 2))
Downloading nine-1.0.0-py2.py3-none-any.whl
Collecting webassets (from tgext.webassets==0.0.2->-r /opt/requirements.txt (line 3))
Downloading webassets-0.12.1.tar.gz (179kB)
Collecting cssmin (from tgext.webassets==0.0.2->-r /opt/requirements.txt (line 3))
Downloading cssmin-0.2.0.tar.gz
Building wheels for collected packages: TurboGears2, Kajiki, tgext.webassets, dukpy, crank, repoze.lru, MarkupSafe, webassets, cssmin
Running setup.py bdist_wheel for TurboGears2: started
Running setup.py bdist_wheel for TurboGears2: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/51/1d/bb/c9cfdcf2a49f71955d5b66aed0dbd187e58e5d77a9fa34a4af
Running setup.py bdist_wheel for Kajiki: started
Running setup.py bdist_wheel for Kajiki: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/ad/fe/15/33e02c73fead4ea9238fcd31d273accf6fb9d922ec901e20c8
Running setup.py bdist_wheel for tgext.webassets: started
Running setup.py bdist_wheel for tgext.webassets: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/00/f2/09/0378f24bd9151b7a927093546c11685899ebec451b65eb181f
Running setup.py bdist_wheel for dukpy: started
Running setup.py bdist_wheel for dukpy: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/21/29/46/34c303b9dca370a8ccc97a84b094c8089b78edde125b0a1fcb
Running setup.py bdist_wheel for crank: started
Running setup.py bdist_wheel for crank: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/1c/00/54/4dcfd62d8268d7b34ea607bd9f8cb12aa930a7718c8c5fbc02
Running setup.py bdist_wheel for repoze.lru: started
Running setup.py bdist_wheel for repoze.lru: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/b2/cd/b3/7e24400bff83325a01d492940eff6e9579f553f33348323d79
Running setup.py bdist_wheel for MarkupSafe: started
Running setup.py bdist_wheel for MarkupSafe: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57
Running setup.py bdist_wheel for webassets: started
Running setup.py bdist_wheel for webassets: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/9d/cb/c2/340b9b695822b6954840bcb6cd147b3a7cfc2bcd922296e63e
Running setup.py bdist_wheel for cssmin: started
Running setup.py bdist_wheel for cssmin: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/c3/79/88/647f59be446af4e9867362ca6e961cc7f218bd793fbdc351a6
Successfully built TurboGears2 Kajiki tgext.webassets dukpy crank repoze.lru MarkupSafe webassets cssmin
Installing collected packages: WebOb, crank, repoze.lru, MarkupSafe, TurboGears2, nine, Kajiki, webassets, cssmin, tgext.webassets, dukpy
Successfully installed Kajiki-0.6.3 MarkupSafe-1.0 TurboGears2-2.3.10 WebOb-1.7.2 crank-0.8.1 cssmin-0.2.0 dukpy-0.1.0 nine-1.0.0 repoze.lru-0.6 tgext.webassets-0.0.2 webassets-0.12.1
---> 86c189792ae7
Removing intermediate container 8845a0efcee7
Step 8/9 : EXPOSE 8080
---> Running in 9243a87c36e2
---> e7d35d54e66d
Removing intermediate container 9243a87c36e2
Step 9/9 : CMD python /statics/js/app.py
---> Running in 6e3b53cd901d
---> 0d79c4f81f3b
Removing intermediate container 6e3b53cd901d
Successfully built 0d79c4f81f3b
So my first question is what does the step 9 means ? does that mean it is attempting to run the /statics/js/app.py path even before I run the container because that would not work as I planned to mount this statics volume from the host.
Secondly, if I run the command:
$ docker run -it -v ~/Development/my-Docker-builds/pythonReact/statics/:/statics/ -d ciasto/pythonreact:v2
03d77c87651e752450e3be0aa64a0841c088b32a1db5424ad96c150c949d0366
I get the hash key but nothing works ! I do not even see the start trace or error message of app.py had any error.
So how should I run the app.py from host mounted volume when I run the container ?
You can consider CMD as the startup script for the container. Having said that at step 9 it is only marking pyhton /statics/js/app.py to be executed whenever you start the container. Also, since you are using -d flag you won't be able to see logs so you have to fetch them using docker logs command as:
docker logs 03d77c87651e752450e3be0aa64a0841c088b32a1db5424ad96c150c949d0366
The logs should be enough to help you figure out the issue. I hope it helps.
Related
I have been struggling with this and I need some help. I am trying to create a docker image of my python app. My App uses orjson, the fast JSON library for python. Parts of this library is built using rust so I need the rust toolchain. Now the kicker is that I am using Alpine for its small footprint so it comes with none of the standard tools included. I need set things up myself.
Here is my Dockerfile to simulate the problem.
FROM python:3.7-alpine
# for orjson in requirements.txt
RUN apk add rust cargo
RUN pip install orjson
This is the error message that I am facing.
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM python:3.7-alpine
---> 6a5ca85ed89b
Step 2/3 : RUN apk add rust cargo
---> Running in b86315a52e50
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/19) Installing rust-stdlib (1.43.1-r1)
(2/19) Installing libgcc (9.3.0-r2)
(3/19) Installing libstdc++ (9.3.0-r2)
(4/19) Installing binutils (2.34-r1)
(5/19) Installing gmp (6.2.0-r0)
(6/19) Installing isl (0.18-r0)
(7/19) Installing libgomp (9.3.0-r2)
(8/19) Installing libatomic (9.3.0-r2)
(9/19) Installing libgphobos (9.3.0-r2)
(10/19) Installing mpfr4 (4.0.2-r4)
(11/19) Installing mpc1 (1.1.0-r1)
(12/19) Installing gcc (9.3.0-r2)
(13/19) Installing musl-dev (1.1.24-r8)
(14/19) Installing libxml2 (2.9.10-r4)
(15/19) Installing llvm10-libs (10.0.0-r2)
(16/19) Installing rust (1.43.1-r1)
(17/19) Installing nghttp2-libs (1.41.0-r0)
(18/19) Installing libcurl (7.69.1-r0)
(19/19) Installing cargo (1.43.1-r1)
Executing busybox-1.31.1-r16.trigger
OK: 334 MiB in 54 packages
Removing intermediate container b86315a52e50
---> 07671da6f533
Step 3/3 : RUN pip install orjson
---> Running in 9c72ff2b2e3e
Collecting orjson
Downloading orjson-3.0.2.tar.gz (649 kB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxhkdxsol
cwd: /tmp/pip-install-0x1gorur/orjson
Complete output (14 lines):
đź’Ą maturin failed
Caused by: Cargo metadata failed. Do you have cargo in your PATH?
Caused by: Error during execution of `cargo metadata`: error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Z mutable-noalias --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: the option `Z` is only accepted on the nightly compiler
Checking for Rust toolchain....
Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-7txy00_d --manylinux=off --strip=on`
Error: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-7txy00_d', '--manylinux=off', '--strip=on']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxhkdxsol Check the logs for full command output.
The command '/bin/sh -c pip install orjson' returned a non-zero code: 1
I am a bit lost on what I should install for getting a rust environment in Alpine. Any help would be appreciated.
Please follow this github issue discussion to get more clarity on it.
Dockerfile
FROM alpine:3.10
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.10/main" >> /etc/apk/repositories
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories
RUN apk add --no-cache python3 gcompat patchelf
RUN patchelf --add-needed libgcompat.so.0 /usr/bin/python3.7
RUN echo 'manylinux1_compatible = True' > /usr/lib/python3.7/_manylinux.py &&\
pip3 install orjson &&\
rm /usr/lib/python3.7/_manylinux.py
Most distros use glibc, alpine uses musl and that's the reason you have to recompile everything. If you are really in the need of building a production grade container, yeah, you're kind of doomed to find and install all the dependencies.
If you're like me and you're only getting your dev env running, just switch from alpine to stretch and all your problems will go away.
Here's the source:
https://github.com/ijl/orjson/issues/98#issuecomment-643248331
I managed to get it to work thanks to #nitishkumar-singh response. There were some errors in that post here is my Dockerfile if someone runs into this issue.
FROM python:3.7-alpine3.11
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.11/main" >> /etc/apk/repositories
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.11/community" >> /etc/apk/repositories
RUN apk add --no-cache python3 gcompat patchelf
RUN patchelf --add-needed libgcompat.so.0 /usr/bin/python3
RUN echo 'manylinux1_compatible = True' > /usr/local/lib/python3.7/_manylinux.py &&\
pip3 install orjson &&\
rm /usr/local/lib/python3.7/_manylinux.py
I am trying to deploy a falcon app with Docker. Here is my Dockerfile:
FROM python:2-onbuild
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
RUN pip install -r ./requirements.txt
RUN pip install uwsgi
EXPOSE 8000
CMD ["uwsgi", "--http”, " :8000" , "—wsgi-file”, "falconapp.wsgi"]
However I keep getting error saying:
/bin/sh: 1: [uwsgi,: not found
I've tried running uwsgi in the local directory and it works well with the command:
uwsgi --http :8000 --wsgi-file falconapp.wsgi
Why is Docker not working in this case???
Here is the log, I'm pretty sure uwsgi is installed:
Step 5/7 : RUN pip install uwsgi
---> Running in 2df7c8e018a9
Collecting uwsgi
Downloading uwsgi-2.0.17.tar.gz (798kB)
Building wheels for collected packages: uwsgi
Running setup.py bdist_wheel for uwsgi: started
Running setup.py bdist_wheel for uwsgi: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/94/c9/63/e7aef2e745bb1231490847ee3785e3d0b5f274e1f1653f89c5
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.17
Removing intermediate container 2df7c8e018a9
---> cb71648306bd
Step 6/7 : EXPOSE 8000
---> Running in 40daaa0d5efa
Removing intermediate container 40daaa0d5efa
---> 39c75687a157
Step 7/7 : CMD ["uwsgi", "--http”, " :8000" , "—wsgi-file”, "falconapp.wsgi"]
---> Running in 67e6eb29f3e0
Removing intermediate container 67e6eb29f3e0
---> f33181adbcfa
Successfully built f33181adbcfa
Successfully tagged image_heatmap:latest
dan#D-MacBook-Pro:~/Documents/falconapp_api$ docker run -p 8000:80 small_runner
/bin/sh: 1: [uwsgi,: not found
very often you have to write the full patch for the executable. If you go to your container and run this command whereis uwsgi it will tell you it is at /usr/local/bin/uwsgi so your CMD should be in the same form:
CMD ["/usr/local/bin/uwsgi", "--http", " :8000" , "--wsgi-file", "falconapp.wsgi"]
I see some incorrect syntax in CMD, please use this:
CMD ["uwsgi", "--http", " :8000" , "--wsgi-file", "falconapp.wsgi"]
some double quotes are incorrect and -- is not before wsgi-file .
I followed some online Docker tutorial and I wrote this Dockerfile:
FROM python:3.5-slim
WORKDIR /opt
COPY requirements.txt /opt/requirements.txt
RUN pip install -r /opt/requirements.txt
COPY hello.py /opt/hello.py
EXPOSE 5000
CMD ["python", "/opt/hello.py"]
I built my image with: docker build -t ciasto/pythonflask:v1 .
that resulted in:
$ docker build -t ciasto/pythonflask:v1 .
Sending build context to Docker daemon 4.096 kB
Step 1/7 : FROM python:3.5-slim
3.5-slim: Pulling from library/python
10a267c67f42: Already exists
f68a39a6a5e4: Pull complete
fb30faeeb5d1: Pull complete
b6ab8c11f85f: Pull complete
69739f677b7a: Pull complete
Digest: sha256:6cbef17164fc35bed1f43b8cb671c51f5622881008fd748eaf80c20e7bfc0079
Status: Downloaded newer image for python:3.5-slim
---> b27a94c44674
Step 2/7 : WORKDIR /opt
---> a7724a7ac155
Removing intermediate container 356124f40ff1
Step 3/7 : COPY requirements.txt /opt/requirements.txt
---> 9fd790ec548d
Removing intermediate container 8ba92114cd28
Step 4/7 : RUN pip install -r /opt/requirements.txt
---> Running in d23ef61ca5fc
Collecting Flask==0.10.1 (from -r /opt/requirements.txt (line 1))
Downloading Flask-0.10.1.tar.gz (544kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
Collecting Jinja2>=2.4 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1->-r /opt/requirements.txt (line 1))
Downloading itsdangerous-0.24.tar.gz (46kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask==0.10.1->-r /opt/requirements.txt (line 1))
Downloading MarkupSafe-1.0.tar.gz
Building wheels for collected packages: Flask, itsdangerous, MarkupSafe
Running setup.py bdist_wheel for Flask: started
Running setup.py bdist_wheel for Flask: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/b6/09/65/5fcf16f74f334a215447c26769e291c41883862fe0dc7c1430
Running setup.py bdist_wheel for itsdangerous: started
Running setup.py bdist_wheel for itsdangerous: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/fc/a8/66/24d655233c757e178d45dea2de22a04c6d92766abfb741129a
Running setup.py bdist_wheel for MarkupSafe: started
Running setup.py bdist_wheel for MarkupSafe: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57
Successfully built Flask itsdangerous MarkupSafe
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask
Successfully installed Flask-0.10.1 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 itsdangerous-0.24
---> 775e776b6838
Removing intermediate container d23ef61ca5fc
Step 5/7 : COPY hello.py /opt/hello.py
---> 19591aa43188
Removing intermediate container 72a6ba817af0
Step 6/7 : EXPOSE 5000
---> Running in e40c405a1f23
---> 3174d4ca3001
Removing intermediate container e40c405a1f23
Step 7/7 : CMD python /opt/hello.py
---> Running in 6da3612345ae
---> 5504685771d5
Removing intermediate container 6da3612345ae
Successfully built 5504685771d5
macHost:pythonflask$
When I do docker ps -a I get nothing. What did I do wrong? I am not even getting any error. I am on Mac OS Sierra.
$ docker -v
Docker version 1.13.1, build 092cba3
To see the list of all built images with docker, run docker images. It should show the name of your image which you can then run with docker run ciasto/pythonflask:v1.
More about docker run command on this link.
Im doing Google Ap Engine application,using Flask
when im add lib in requirements.txt my applcication not deploying
content requirements.txt
Flask==0.10.1
gunicorn==19.4.5
google-api-python-client==1.5.0
oauth2client==2.0.1
pandas==0.18.0
end its return error
ERROR: (gcloud.preview.app.deploy) Docker build aborted: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 143
if im remove "google-api-python-client",error disappear
I'm trying to run Travis-CI on a module I've made. Nosetests pass on my local machine with flying colors, but for some reason the test.py file is failing to import my project. Below is the full output from Travis-CI:
Using worker: ppp3.worker.travis-ci.org:php-4
$ cd ~/builds
$ git clone --branch=master --depth=100 --quiet git://github.com/louist87/Scrappy.git louist87/Scrappy
$ cd louist87/Scrappy
$ git checkout -qf 68d1291c8a81638554d036aa01215632a6661623
$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.3
$ pip --version
pip 1.2.1 from /home/travis/virtualenv/python2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg (python 2.7)
$ pip install -r requirements.txt --use-mirrors
Downloading/unpacking guessit>=0.5.2 (from -r requirements.txt (line 1))
Downloading guessit-0.5.3.tar.gz (45kB): 45kB downloaded
Running setup.py egg_info for package guessit
Downloading/unpacking tvdb-api>=1.8.2 (from -r requirements.txt (line 2))
Downloading tvdb_api-1.8.2.tar.gz
Running setup.py egg_info for package tvdb-api
Downloading/unpacking hachoir-metadata>=1.3.3 (from -r requirements.txt (line 3))
Downloading hachoir-metadata-1.3.3.tar.gz (52kB): 52kB downloaded
Running setup.py egg_info for package hachoir-metadata
Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
(use command "-c egg_info --egg-base pip-egg-info --disable-qt" to disable this warning)
Downloading/unpacking hachoir-core>=1.3.3 (from -r requirements.txt (line 4))
Downloading hachoir-core-1.3.3.tar.gz (91kB): 91kB downloaded
Running setup.py egg_info for package hachoir-core
Downloading/unpacking hachoir-parser>=1.3.4 (from -r requirements.txt (line 5))
Downloading hachoir-parser-1.3.4.tar.gz (359kB): 359kB downloaded
Running setup.py egg_info for package hachoir-parser
warning: no files found matching 'metadata_csv.py'
Installing collected packages: guessit, tvdb-api, hachoir-metadata, hachoir-core, hachoir-parser
Running setup.py install for guessit
Running setup.py install for tvdb-api
Running setup.py install for hachoir-metadata
Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
(use command "-c install --record /tmp/pip-Xc_ilb-record/install-record.txt --single-version-externally-managed --install-headers /home/travis/virtualenv/python2.7/include/site/python2.7 --disable-qt" to disable this warning)
changing mode of build/scripts-2.7/hachoir-metadata from 664 to 775
changing mode of build/scripts-2.7/hachoir-metadata-gtk from 664 to 775
changing mode of build/scripts-2.7/hachoir-metadata-qt from 664 to 775
deleting hachoir_metadata.egg-info/requires.txt
changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata-qt to 775
changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata to 775
changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata-gtk to 775
Running setup.py install for hachoir-core
Running setup.py install for hachoir-parser
deleting hachoir_parser.egg-info/requires.txt
warning: no files found matching 'metadata_csv.py'
Successfully installed guessit tvdb-api hachoir-metadata hachoir-core hachoir-parser
Cleaning up...
$ nosetests -w tests/
E
======================================================================
ERROR: Failure: ImportError (No module named scrappy.core)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/travis/builds/louist87/Scrappy/tests/test.py", line 8, in <module>
import scrappy.core as scrappy
ImportError: No module named scrappy.core
----------------------------------------------------------------------
Ran 1 test in 0.004s
FAILED (errors=1)
Done. Build script exited with: 1
Note that Scrappy is the name of my project and that is what's failing to import.
And here is my .travis.yml file:
language: python
python:
- "2.7"
install: "pip install -r requirements.txt --use-mirrors"
script: "nosetests -w tests/"
Any idea what could be wrong?
Ok, so it turns out that Travis-CI doesn't do an implicit develop when installing the target package.
This was fixed by editing the script line in the YAML file to:
script: "python setup.py develop && nosetests -w tests/"