Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'rez build --install --prefix' error #858

Closed
ClementHector opened this issue Feb 24, 2020 · 8 comments
Closed

'rez build --install --prefix' error #858

ClementHector opened this issue Feb 24, 2020 · 8 comments
Labels

Comments

@ClementHector
Copy link

Hi there!

We encountered the following error while deploying a library of ours in a specific directory with rez on a python's docker image through Gitlab CI/CD.

We'd be grateful if you could tell us how to resolve this issue by ourselves or if you could fix it!
We might have missed some context or information in this comment; please tell us so if necessary.

Many thanks in advance.

rez build --install --prefix /mnt/rnd/PIPELINE/USER/HC
Building into: '/mnt/rnd/PIPELINE/USER/HC'

--------------------------------------------------------------------------------
Building smurfs-0.0.27...
--------------------------------------------------------------------------------
Resolving build environment: ellipsanime '~maya==2018.6' '~houdini==17.0.352' '~nuke==11.3.4' ellipsanime rez_utils-1
resolved by root@runner-c392f0d9-project-56-concurrent-0, on Mon Feb 24 17:08:30 2020, using Rez v2.40.4

requested packages:
ellipsanime         
~maya==2018.6       
~houdini==17.0.352  
~nuke==11.3.4       
ellipsanime         
rez_utils-1         
~platform==linux    (implicit)
~arch==x86_64       (implicit)
~os==debian-10      (implicit)

resolved packages:
ellipsanime-0.0.3  /mnt/rnd/PIPELINE/__PACKAGES__/project/ellipsanime/0.0.3  
python-3.7.6       /mnt/rnd/PIPELINE/__PACKAGES__/app/python/3.7.6           
rez_utils-1.0.3    /mnt/rnd/PIPELINE/__PACKAGES__/int/rez_utils/1.0.3        

Invoking custom build system...
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/rez/serialise.py", line 71, in open_file_for_write
    f.write(content)
  File "/usr/local/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.7/site-packages/rez/vendor/atomicwrites/__init__.py", line 154, in _open
    self.commit(f)
  File "/usr/local/lib/python3.7/site-packages/rez/vendor/atomicwrites/__init__.py", line 185, in commit
    replace_atomic(f.name, self._path)
  File "/usr/local/lib/python3.7/site-packages/rez/vendor/atomicwrites/__init__.py", line 92, in replace_atomic
    return _replace_atomic(src, dst)
  File "/usr/local/lib/python3.7/site-packages/rez/vendor/atomicwrites/__init__.py", line 50, in _replace_atomic
    _sync_directory(os.path.normpath(os.path.dirname(dst)))
  File "/usr/local/lib/python3.7/site-packages/rez/vendor/atomicwrites/__init__.py", line 44, in _sync_directory
    _proper_fsync(fd)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/rez", line 8, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.7/site-packages/rez/cli/_main.py", line 153, in run
    returncode = run_cmd()
  File "/usr/local/lib/python3.7/site-packages/rez/cli/_main.py", line 145, in run_cmd
    return opts.func(opts, opts.parser, extra_arg_groups)
  File "/usr/local/lib/python3.7/site-packages/rez/cli/build.py", line 170, in command
    variants=opts.variants)
  File "/usr/local/lib/python3.7/site-packages/rezplugins/build_process/local.py", line 41, in build
    install=install)
  File "/usr/local/lib/python3.7/site-packages/rez/build_process_.py", line 203, in visit_variants
    result = func(variant, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rezplugins/build_process/local.py", line 280, in _build_variant
    variant.install(install_path)
  File "/usr/local/lib/python3.7/site-packages/rez/packages_.py", line 402, in install
    overrides=overrides)
  File "/usr/local/lib/python3.7/site-packages/rezplugins/package_repository/filesystem.py", line 625, in install_variant
    variant = _create_variant()
  File "/usr/local/lib/python3.7/site-packages/rezplugins/package_repository/filesystem.py", line 618, in _create_variant
    overrides=overrides
  File "/usr/local/lib/python3.7/site-packages/rezplugins/package_repository/filesystem.py", line 1077, in _create_variant
    dump_package_data(package_data, buf=f, format_=package_format)
  File "/usr/local/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.7/site-packages/rez/serialise.py", line 73, in open_file_for_write
    except WindowsError as e:
NameError: name 'WindowsError' is not defined
ERROR: Job failed: exit code 1
@nerdvegas
Copy link
Contributor

I haven't seen this error, have you determined that it's related to running within a container?

The second stacktrace looks like it's simply caused by a missing import for the WindowsError, I will look into that. In the meantime perhaps if you could narrow down the repro, if possible.

Cheers!
A

@alexxbb
Copy link

alexxbb commented Sep 21, 2020

Hit a simillar problem: NameError: name 'WindowsError' is not defined

https://github.com/nerdvegas/rez/blob/master/src/rez/serialise.py#L76

@nerdvegas
Copy link
Contributor

nerdvegas commented Sep 22, 2020 via email

@alexxbb
Copy link

alexxbb commented Sep 22, 2020

Wonder why is this windows-specific WindowsError in the code in the first place? I'm getting errors on Linux with Python2.

@nerdvegas
Copy link
Contributor

Oh, I haven't seen failures with atomiwrites on linux before, I'd assumed you were on Windows.

Would it be possible to isolate this to a small repro using atomicwrites only? I am assuming this is an edge case we've not seen before - if this were failing in the general case, I'd have gotten loads of bug reports.

@alexxbb
Copy link

alexxbb commented Sep 23, 2020

rez-pip --install --release --python-version=2.7 python-gitlab

Traceback (most recent call last):
  File "/usr/bin/rez-pip", line 8, in <module>
    sys.exit(run_rez_pip())
  File "/opt/rez/lib/python2.7/site-packages/rez/cli/_entry_points.py", line 188, in run_rez_pip
    return run("pip")
  File "/opt/rez/lib/python2.7/site-packages/rez/cli/_main.py", line 152, in run
    returncode = run_cmd()
  File "/opt/rez/lib/python2.7/site-packages/rez/cli/_main.py", line 144, in run_cmd
    return opts.func(opts, opts.parser, extra_arg_groups)
  File "/opt/rez/lib/python2.7/site-packages/rez/cli/pip.py", line 67, in command
    extra_args=opts.extra)
  File "/opt/rez/lib/python2.7/site-packages/rez/pip.py", line 404, in pip_install_package
    pkg.is_pure_python = metadata["is_pure_python"]
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/opt/rez/lib/python2.7/site-packages/rez/package_maker.py", line 217, in make_package
    variant_ = variant.install(path)
  File "/opt/rez/lib/python2.7/site-packages/rez/packages.py", line 413, in install
    overrides=overrides)
  File "/opt/rez/lib/python2.7/site-packages/rezplugins/package_repository/filesystem.py", line 655, in install_variant
    variant = _create_variant()
  File "/opt/rez/lib/python2.7/site-packages/rezplugins/package_repository/filesystem.py", line 648, in _create_variant
    overrides=overrides
  File "/opt/rez/lib/python2.7/site-packages/rezplugins/package_repository/filesystem.py", line 1114, in _create_variant
    dump_package_data(package_data, buf=f, format_=package_format)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/opt/rez/lib/python2.7/site-packages/rez/serialise.py", line 74, in open_file_for_write
    except WindowsError as e:
NameError: global name 'WindowsError' is not defined

Without --release it installed locally just fine. Hope this helps.

Thanks.

@jlorrain
Copy link

I have encountered the same issue using debian.
I tried to install a pip package on a rez repository mounted from my network.

This seems to happen because some fs don't handle sync for directories (used to ensure atomicity) : untitaker/python-atomicwrites#17

my current workaround is to call rez pip on a local directory and use rsync before and after the call to transfert the newly installed package

Since atomicity can't be guaranteed within Network repositories, it would be nice to use a simple (non atomic) method if atomicwrites fail with this error (OSError: [Errno 22])

@nerdvegas
Copy link
Contributor

fixed in #998

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants