source

OSX 10.11(El Capitan)(시스템 무결성 보호)에 스크래피를 설치할 때 "OSError: [Errno 1] 작업이 허용되지 않음"

factcode 2022. 9. 6. 22:18
반응형

OSX 10.11(El Capitan)(시스템 무결성 보호)에 스크래피를 설치할 때 "OSError: [Errno 1] 작업이 허용되지 않음"

OSX 10.11 (El Capitan)에 Scrapy Python Framework를 pip으로 설치하려고 합니다.설치 스크립트는 필요한 모듈을 다운로드하여 다음 오류를 반환합니다.

OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

다음 명령어를 사용하여 OSX 10.11의 루트리스 기능을 비활성화하려고 했습니다.

sudo nvram boot-args="rootless=0";sudo reboot

컴퓨터를 재부팅해도 같은 에러가 발생합니다.

동료 StackExchangers로부터 힌트나 아이디어가 있나요?

도움이 되는 경우 스크립트의 전체 출력은 다음과 같습니다.

sudo -s pip install scrapy
Collecting scrapy
  Downloading Scrapy-1.0.2-py2-none-any.whl (290kB)
    100% |████████████████████████████████| 290kB 345kB/s 
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy)
Collecting w3lib>=1.8.0 (from scrapy)
  Downloading w3lib-1.12.0-py2.py3-none-any.whl
Collecting lxml (from scrapy)
  Downloading lxml-3.4.4.tar.gz (3.5MB)
    100% |████████████████████████████████| 3.5MB 112kB/s 
Collecting Twisted>=10.0.0 (from scrapy)
  Downloading Twisted-15.3.0.tar.bz2 (4.4MB)
    100% |████████████████████████████████| 4.4MB 94kB/s 
Collecting six>=1.5.2 (from scrapy)
  Downloading six-1.9.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Twisted>=10.0.0->scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from zope.interface>=3.6.0->Twisted>=10.0.0->scrapy)
Installing collected packages: six, w3lib, lxml, Twisted, scrapy
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall
paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, in renames
shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
pip install --ignore-installed six

효과가 있을 거야

출처 : github.com/pypa/pip/issues/3165

또한 OS X를 해킹할 필요는 전혀 없다고 생각합니다.

저는 그걸 풀 수 있었어요.

brew install python

새로운 El Capitan에 부속된 python / pip을 사용하는 것은 문제가 있는 것 같습니다.

다른 답변에서도 언급되었듯이 새로운 시스템 무결성 보호 때문입니다만, 다른 답변은 지나치게 복잡하다고 생각합니다.

현재 사용자에게만 해당 패키지를 사용하는 경우 SIP를 디세블로 할 필요 없이 를 사용하여 패키지를 정상적으로 설치할 수 있습니다.--userflag. 이렇게.

sudo pip install --user packagename

투표율이 높은 답변은 저에게 효과가 없었습니다. El Capitan 사용자에게는 효과가 있는 것 같습니다.MacOS Sierra 사용자의 경우 다음 단계를 시도해 보십시오.

  1. brew install python
  2. sudo pip install --user <package name>

경고.

Mac에서 시스템 Python을 수정하는 것을 강력히 반대합니다.여러 가지 문제가 발생할 수 있습니다.

특정 오류는 설치 관리자가 현재 Python 설치에 영향을 주지 않고 Scrapy의 종속성을 해결하는 데 문제가 있음을 나타냅니다.이 시스템은 많은 필수 작업에 Python을 사용하기 때문에, 시스템의 인스톨을 안정적으로 유지하는 것이 중요합니다.

또한 내장된 보안을 우회하기 전에 다른 모든 가능성을 다 동원할 것입니다.

패키지 매니저 솔루션:

먼저 virtualenv와 같은 Python 가상화 도구를 살펴보십시오. 그러면 안전하게 실험할 수 있습니다.

Mac OS와 충돌하지 않고 언어와 소프트웨어를 사용할 수 있는 또 다른 유용한 도구는 Homebrew입니다.MacPorts나 Fink마찬가지Homebrew는 Mac용 패키지 매니저이며 다른 많은 언어 및 도구를 안전하게 사용해 볼 때 유용합니다.

"Roll your own" Software Installs:

If you don't like the package manager approach, you could use the /usr/local path or create an /opt/local directory for installing an alternate Python installation and fix up your paths in your .bashrc. Note that you'll have to enable root for these solutions.

How to do it anyway:

If you absolutely must disable the security check (and I sincerely hope it's for something other than messing with the system languages and resources), you can disable it temporarily and re-enable it using some of the techniques in this post on how to Disable System Integrity-Protection.

This did the trick for me:

   sudo pip install scrapy --ignore-installed six

I tried to install AWS via pip in El Capitan but this error appear

OSError: [Errno 1] Operation not permitted: '/var/folders/wm/jhnj0g_s16gb36y8kwvrgm7h0000gp/T/pip-wTnb_D-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

I found the answer here

sudo -H pip install awscli --upgrade --ignore-installed six

It works for me :)

You should disable "System Integrity Protection" which is a new feature in El Capitan.

First, you should run the command for rootless config on your terminal

# nvram boot-args="rootless=0"
# reboot

Then, you should run the command below on recovery partition's terminal (Recovery OS)

# csrutil disable
# reboot

I've just solved my problem like that. I'm not sure that the first part is necessary. Try as you like.

--WARNING

You should enable SIP again after everything works;

Simply reboot again into Recovery Mode and run in terminal

# csrutil enable

csrutil: Configuring System Integrity Protection

I was getting the same error on on my MacOS Sierra. I followed these steps and successfully able to install scarpy package.

1. sudo pip install --ignore-installed six
2. sudo pip install --ignore-installed scrapy

MacBook-Air:~ shree$ scrapy version
Scrapy 1.4.0

This did the trick for me.

sudo pip install --ignore-installed scrapy

Tried a combination of some answers and this eventually worked:

sudo -H pip install --upgrade --ignore-installed awsebcli

Cheers

install python again:

brew install python

try it again:

sudo pip install scrapy

works for me, hope it can help

Restart Mac -> hold down "Command + R" after the startup chime -> Opens OS X Utilities -> Open Terminal and type "csrutil disable" -> Reboot OS X -> Open Terminal and check "csrutil status"

This command would work perfectly fine :D

sudo -H pip install --upgrade package_name --ignore-installed six

Sometimes such behavior may be achieved if you try to install python3 lib in python2 folder using pip instead of pip3.

  1. -- close SIP(system Integrity Protection) -- then reboot, use command +R to enter debug mode, then select terminal: csrutil disable reboot

2.

sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 :/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/libxml :/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include pip install scrapy --ignore-installed six

3. -- then remove old six, install it again sudo rm -rf /Library/Python/2.7/site-packages/six* sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six* sudo pip install six

4. -- then set it back csrutil enable reboot

-- crappy works now

it work for me:

pip install scrapy --user -U

I was missing a dependency somewhere else along the line, so I installed the other requirements for the project like this:

pip install --user -r requirements.txt

ReferenceURL : https://stackoverflow.com/questions/31900008/oserror-errno-1-operation-not-permitted-when-installing-scrapy-in-osx-10-11

반응형