Neo4j Docker - LOAD CSV - Couldn't load the external resource

Neo4j (with Docker) Version: 3.1.7
Operating System: Xubuntu 16.04
API: Python

Created Neo4j Docker with the following:
sudo docker run
--net=dnet01 --ip=1*** 1
--env=NEO4J_dbms_tx_log_rotation_retention_policy="2 days"
--publish=7473:7473 --publish=7474:7474 --publish=7687:7687
--env NEO4J_AUTH=neo4j/

-d neo4j:3.1.7

Placed a test_file in location: /production/analytics/Temp/test-file.csv
Then tried to run below code in python:
with neosession.begin_transaction() as tx:"""LOAD CSV WITH HEADERS FROM {csv_file} AS row
MERGE (s:Test {Name: row._Name})
SET = row._id"""
,{'csv_file': file_id}

When I run the above script I get the below error:
neo4j.v1.exceptions.CypherError: Couldn't load the external resource at: file:/production/analytics/Temp/test-file.csv

My neo4j conf has the following:
Below is commented out:

Below option in uncommented:

Not sure why the file in not being accessed: /production/analytics/Temp/test-file.csv

This is not a valid file URL. I think you're looking for:


And that must exist in the docker container.

Note that's a TRIPLE slash, and not an error. The first two slashes are about the file:// scheme, and the last slash is the root directory on your machine.

Hi David,
I do merge the file:/// to the file name and then pass it to the query.
I also did try with:"""LOAD CSV WITH HEADERS FROM 'file:///test_file.csv' AS row
MERGE (s:Test {Name: row._Name})
SET = row._id"""

But i get the same error: " Couldn't load the external resource at: file:/production/analytics/Temp/test_file.csv"

"And that must exist in the docker container." - I didn't quite get this? I am already setting the import directory as: --volume=/production/analytics/Temp:/var/lib/neo4j/import while running my docker.

Is there somewhere else I need to make any change?

I am having a very similar issue. I am running a locally deployed Kubernetes Neo4j cluster with 3 cores and 3 replicas. I copied my .csv files to /var/lib/neo4j/import inside of core 0 docker container. Then I go to the CLI and start cypher-shell:

# pwd         
# ls
USAir_edges.csv  USAir_nodes.csv
# cypher-shell
Connected to Neo4j 4.2.0 at neo4j://localhost:7687.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
@neo4j> load csv with headers from 'file:///USAir_nodes.csv' as row
        create (n:Node {id: toInteger(});
Couldn't load the external resource at: file:/var/lib/neo4j/import/USAir_nodes.csv

I do not quite get why it can't be loaded and why the resource is "external" in this case.. Could you take a look at the issue please?

1 Like

I have the same problem. Have you solved the problem?


confused as


but yet


and Temp has a trailing : is that correct? ???

also if the import directory us --volume=/production/analytics/Temp:/var/lib/neo4j/import and whether there is a : after Temp or not ??? but if test_file.csv is in this path, i.e. namely /production/analytics/Temp:/var/lib/neo4j/import/test_file.csv then the load csv should simply reference file:///test_file.csv

1 Like

Was this issue ever resolved? I am still facing the same issue. I have 3 node neo4j cluster and each cluster member is running in a docker constainer in different host.

I have mapped the import folder from the host to the container at /var/lib/neo4j/import

When I run this command:
LOAD CSV FROM 'file:///products.csv' AS line RETURN DISTINCT file() AS path;

I still get this error:
Couldn't load the external resource at: file:/var/lib/neo4j/import/products.csv