Invalid cross-device link

When running either
sudo sls package or sudo sls deploy

I get the following traceback:
Error: ERROR: Exception:
Traceback (most recent call last):
File “/var/lang/lib/python3.6/”, line 550, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: ‘/tmp/pip-target-wqc5grcw/lib/python/setuptools’ -> ‘/var/task/setuptools’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/”, line 228, in _main
status =, args)
File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/”, line 182, in wrapper
return func(self, options, args)
File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/”, line 456, in run
options.target_dir, target_temp_dir, options.upgrade
File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/”, line 514, in _handle_target_dir
File “/var/lang/lib/python3.6/”, line 561, in move
File “/var/lang/lib/python3.6/”, line 321, in copytree
File “/var/lang/lib/python3.6/”, line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/var/task/setuptools’

I tried the solution suggested in this post but it doesn’t work for me. AWS Python Lambda giving Error: Invalid 'cross-device link' for patsy-0.5.1

I’ve created several different projects and they work locally but they never progress beyond this invalid cross-link device Error when trying to deploy or package

SOLUTION: my project folder had to be on a file system which gave me permission to perform sls deploy without using sudo